Professional Documents
Culture Documents
Door
Door
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_P
예제로 보는
오늘의 목표
NO
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_PF
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_P
NO
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_PF
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_P
YES
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_PF
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_P
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_PF
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_P
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_PF
APCPCWM_4828539:WP_GLOBAL_PFWP_GLOBAL_P
Python Basic
Indentation
• Python에서 Indentation으로 Code Block(Scope)를 구분
Python Basic
• 변수
• 변수명으로 문자 / 숫자 / ‘_’ 가 사용 가능하며 대소문자 구분
Python Basic
• 수치형 자료
• 숫자를 나타내는 자료형
Python Basic
• 문자열
• 문자열은 “ ”, ‘ ’, 로 묶으며, 다수의 문자열은 ‘‘‘ ’’’ (홑 따음표) 3개를 묶는다.
이를 Placeholder이라고 한다.
( )로 묶어준다.
Placeholder Example
name = ‘zigi’
blog = ‘zigispace.net’
mystr = ‘%s Blog : %s’
print(mystr %(name,blog))
Python Basic
• List
• 다수의 객체를 하나의 객체로 관리하는 데이터 타입
• [ ] 안의 항목들은 각각의 index position을 가지며, index는 0부터 시작. (zero base)
List Example
blog = [‘zigi‘, ‘space’]
blog.append(‘.net’)
blog.insert(0,’http://’)
Python Basic
• Tuple
• 다수의 객체를 하나의 객체로 관리하는 데이터 타입
tuple Example
myT = (1,2,3)
First, second = 10, 20
Blog = (‘zigi’ , ‘space’)
Python Basic
• Dictionary / Map
• 다수의 객체를 하나의 객체로 관리하는 데이터 타입이라는 것은 List와 동일하지만,
Dictionary Example
dns = { ‘kt’:’168.126.63.1’, ‘lg’:’164.124.107.9’, ‘sk’:’210.220.163.82’ }
dns[‘kt’]
Python Basic
• If (조건문)
• 조건문에 따라서 구문 실행, 조건에 만족하지 않을 경우에 실행하기 위해서는 else 사용.
Python Basic
• while (반복문)
• 조건식이 True인 동안 반복문 수행
While 조건식:
반복구문
while Example
count = 10
while count >= 0:
print count
count = count -1
Python Basic
• For (반복문)
• Sequence형 혹은 Iteration이 가능한 객체에 대해서 순차적으로 반복문 수행
for Example
mylist = ['Ko','Jae','Sung']
for op in mylist:
print op
Python Basic
• Range
• 일정한 수열을 반복하도록 만든 메서드
• return 값은 Iterator 값을 반환
range Example
evenNumber = range(0,10,2)
for op in evenNumber:
print op
Python Basic
Python Basic
• Function, Method
• 여러 줄의 명령을 하나의 범위로 지정하여 특정한 역할을 하도록 만든 것
print(SumFunc(10,20))
TextFSM
https://github.com/google/textfsm
Netmiko
https://github.com/ktbyers/netmiko
Paramiko
http://www.paramiko.org
pyntc
https://github.com/networktocode/pyntc
napalm
NAPALM
(Network Automation
and
Programmability
Abstraction Layer
with
Multivendor
https://napalm-automation.net/
ncclient
https://napalm-automation.net/
https://napalm.readthedocs.io/en/latest/support/index.ht
ml
네트워크 벤더 라이브러리
F5 SDK
https://github.com/F5Networks/f5-common-python
네트워크 벤더 라이브러리
PyNOS
https://github.com/BRCDcomm/pynos
네트워크 벤더 라이브러리
Extreme
https://github.com/extremenetworks/ExtremeScripting
네트워크 벤더 라이브러리
pyeapi
https://github.com/aristanetworks/EosSdk
네트워크 벤더 라이브러리
nitro
https://github.com/citrix/netscaler-nitro-api
네트워크 벤더 라이브러리
Cobra / NXAPI
https://github.com/citrix/netscaler-nitro-api
네트워크 벤더 라이브러리
fortiosapi
https://github.com/fortinet-solutions-cse/fortiosapi
네트워크 벤더 라이브러리
CheckPoint
https://github.com/citrix/netscaler-nitro-api
네트워크 벤더 라이브러리
PyEZ
https://github.com/citrix/netscaler-nitro-api
https://github.com/ktbyers/netmiko/blob/develop/docs/source/index.rst
http://netmiko.readthedocs.io/en/stable/index.html
따라해보기 : netmiko
따라해보기 : 설치해보기
따라해보기 : 설치해보기
따라해보기 : 설치해보기
따라해보기 : 설치해보기
따라해보기 : 설치해보기
따라해보기 : 설치해보기
따라해보기 : 설치해보기
따라해보기 : 설치해보기
따라해보기 : 테스트 코드
장비 Inventory
장비 접속
명령어 전송
결과 값
• 벤더에서 제공되는 API만으로는 원하는 값을 모두 만들기가 어렵기 때문에 아직까지는 반드시 필요한 부분.
• Python 문자열 연산
• 두 개 이상의 문자열은 ‘+’ 기호를 사용하여 연결
• 각 Formatting 코드에 맞춰서 값을 넣어야 하지만, %s로 지정할 경우에는 자동 변환이 되서 들어가게 된다.
• %숫자s 과 같이 %와 Formatting 코드 사이에 숫자를 넣으면 해당 크기만큼 공간을 할당해서 출력하게 된다.
• join(sequence)
• lstrip([chars])
•split([separator, [maxsplit]])