NETCONFを使ってOSPFを行う
ルーターのL3IPは事前に設定済み
R3とR4はすでに設定済みでOSPFが稼働済み
PythonプログラムでCSR1とCSR2を設定する
ncclientライブラリを使う
デバイス名.xmlファイルを使う
プログラム実行時にCSR1とCSR2はすべてのルーターとOSPFを形成
ルーター設定
IOS-XE1
hostname IOS-XE1
ip domain-name abc.com
crypto key generate rsa module 1024
ip ssh version 2
username admin privilege 15 password cisco
netconf ssh
netconf-yang
line vty 0 4
login local
transport input all
int gi1
ip address 10.255.1.101 255.255.255.0
description Connect to MGMT
no shut
int gi2
ip address 12.0.0.1 255.255.255.0
description Connect to IOS-XE2
no shut
int gi3
ip address 13.0.0.1 255.255.255.0
description Connect to IOS3
no shut
int gi4
ip address 14.0.0.1 255.255.255.0
description Connect to IOS4
no shut
IOS-XE2
hostname IOS-XE2
ip domain-name abc.com
crypto key generate rsa module 1024
ip ssh version 2
username admin privilege 15 password cisco
netconf ssh
netconf-yang
line vty 0 4
login local
transport input all
int gi1
ip address 10.255.1.102 255.255.255.0
description Connect to MGMT
no shut
int gi2
ip address 12.0.0.2 255.255.255.0
description Connect to IOS-XE1
no shut
int gi3
ip address 23.0.0.2 255.255.255.0
description Connect to IOS3
no shut
int gi4
ip address 24.0.0.2 255.255.255.0
description Connect to IOS4
no shut
IOS3
hostname IOS3
int gi0/1
ip address 13.0.0.3 255.255.255.0
description connected to IOS-XE1
no shut
int gi0/2
ip address 23.0.0.3 255.255.255.0
description connected to IOS-XE2
no shut
router ospf 1
router-id 3.3.3.3
interface range gi0/1-2
ip ospf 1 area 0
ip ospf network point-to-point
IOS4
hostname IOS4
int gi0/1
ip address 14.0.0.4 255.255.255.0
description connected to IOS-XE1
no shut
int gi0/2
ip address 24.0.0.4 255.255.255.0
description connected to IOS-XE2
no shut
router ospf 1
router-id 4.4.4.4
interface range gi0/1-2
ip ospf 1 area 0
ip ospf network point-to-point