본문 바로가기
Networking/Network Automation

CCNP ENAUTO - 1 [Udemy]

by 포항돼지 2025. 4. 2.

People are focus on the application perspective, rather than a network perspective.

This is why network automation concepts comes up.

 

Application 으로 Network 관리할수 있는 거 찾고, Ingrade 시키는거 찾다가 Automation이 나온거

 
 

Solid Network Programmability foundation is required to build the knowledge level.

 

API == Machine to Mahcine interaction rather CLI communication in between machine to machine.

-> always faster rather than human to mahcine interaction

 

Sometimes it takes more time to do rather than directly connect via CLI but it is definately worth it to learn new things.

 
 

Section 01. Network Programmability Foundation

1.learn git (add, commit, clone, push, diff, branching, merging conflict)

  • Going to use GNS3 for our lab testing enviornment

2. API

  • How to implement python scripting on the API

3. IOS XE Platform

  • network configuration tool such as ansible, and interacting with IOS XE platform
 
 
 

01. GIT and GIT Hub

git add .

git commit

git log --oneline --all --graph

git status

git branch

git switch main

git switch coupon

 

git checkout 이랑 git switch/restore 같은 기능, 최신 버전에는 swtich/restore을 씀

  • checkout: Switch branches or restore working tree files
  • switch: Switch branches
  • restore: Restore working tree files
 

git restore

restore는 워킹 트리의 파일을 복원해 주는 역할을 한다.

파일의 수정 내용(README.md 파일을 수정했다고 했을 때)을 복원하려면 git checkout -- README.md처럼 사용했는데 이젠 다음과 같이 사용할 수 있다. 명확하지 않은 checkout --보다는 restore가 더 낫다고 생각한다.

$ git restore README.md

git add를 통해서 수정 내용을 stage에 이미 넣었을 때 이를 다시 빼려면 git reset HEAD README.md를 사용했어야 했는데 이 부분도 restore로 들어왔다. 수정사항을 빼고 조작할 때 모두 restore로 통일되어서 사용하기도 쉬울 테고 이해하기도 좋다.

 

git push

git push는 로컬 브랜치(local branch)를 원격 저장소(remote repository)로 푸시할 때 사용하는 기본 명령어입니다.

git push <remote> <branch>
 
(main)$ git remote -v 
origin  git@github.com:johnmosesman/burner-repo.git (fetch)
origin  git@github.com:johnmosesman/burner-repo.git (push)

(main)$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 274 bytes | 274.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To github.com:johnmosesman/burner-repo.git
   b7f661f..ab77dd6  main -> main

출력에서 로컬 main 브랜치가 원격 main 브랜치로 푸시된 것을 확인할 수 있습니다.

 

git clone

$ git clone https://github.com/lainyzine/git-clone.git Cloning into 'git-clone'... remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done.

 

git clone 쓰면 git-hub에 있는 online repository 그대로 가져와서 사용 가능

git hub에 ssh setting되어 있으면 $ git clone git@github.com:lainyzine/git-clone.git

이렇게 가져오면됨

 

git remote가 바로 원격 저장소를 관리할 수 있는 명령어입니다. git remote add origin https://github.com/[이름]/gitExample origin이라는 이름으로 원격 저장소 주소를 등록

 
 

GNS3 & Virtual Box Install for building a Lab environment

 

Install GNS3

Download GNS3 , Download GN3 VM for Virtual Machine

Install -> Import template -> Done

Built internet connection by using cloud1 node (wifi interface has been added)

Automation node configuration edit

 

 

 

 

For automation Linux enviroment, i installed

 
 
apt-get update
apt-get install python3
apt-get install python3-pi
pip3 install -U netmiko
pip3 install -U napalm
pip3 install -U simplejson
apt-get install git
apt-get install python3-venv
git config --global user.name khg762
git config --global user.email khg762@gmail.com

create P1 directory and set this folder as git folder
mkdir P1
git init



 

git Architecture

 

Remote = git hub (Online Repository)

 
 

git clone == copy the repository

https://github.com/ai-devnet/getting-started-with-cisco-sd-wan-rest-apis.git

 

API

 

What are APIs? before we use REST-API, we need to knox exactly what it is

API == machine to machine langague == it would be game changer for automating

As long as we can established API connection, it will be easy & fast to make it communicate

 

Structure

 

 
 

Need to figure out how the REST works

 

inside of REST

review = get

update object = put

creat new object = post

delete = delete

 

data model

XML , JSON, Yang

 

API strucrture

Use the REST protocol to network device and get JSON/XML

 

get/put/post/delete or CRUD (create/Retrieve/Update/Delete)

What we can do with this?

it is sendinng a payload when they have an update

201 status = 201 created status code means that the rqeust was successfully fulfilled and resulted in one or possibly multiple new resources being created

 

200 status = An HTTP response status code 200 means success. The client has requested documents from the server.

 
 
 
 

cURL = clientURL. is a command line tool that enables data transfer over various network protocol. it communicates with a web or application server by specifying a relevant URL and the data that need to be sent or received.

 
 

Postman = GUI method of testing REST API

 

gRPC (google RPC)

 

syncronous 동시에 발생하는, asyncronous 동시에 발생하지 않는

 

Synchronous

if an API call is synchronous, it means that code execution will block (or wait). mean is that it will have 1 on 1 connection

 

Asynchronous

calls do not block (or wait) for the api call to return from the server. execution continues on in your program, and when the call returns from the server, a 'callback' function is executed.