diff --git a/cloudbuild/vendors/testbed.textproto b/cloudbuild/vendors/testbed.textproto index fe987c0c..a6ddcc3e 100644 --- a/cloudbuild/vendors/testbed.textproto +++ b/cloudbuild/vendors/testbed.textproto @@ -1,69 +1,3 @@ -duts { - id: "ceos" - vendor: ARISTA - ports { - id: "port1" - } - ports { - id: "port2" - } - ports { - id: "port3" - } - ports { - id: "port4" - } - ports { - id: "port5" - } - ports { - id: "port6" - } -} -duts { - id: "ncptx" - vendor: JUNIPER - ports { - id: "port1" - } - ports { - id: "port2" - } - ports { - id: "port3" - } - ports { - id: "port4" - } - ports { - id: "port5" - } - ports { - id: "port6" - } -} -duts { - id: "srl" - vendor: NOKIA - ports { - id: "port1" - } - ports { - id: "port2" - } - ports { - id: "port3" - } - ports { - id: "port4" - } - ports { - id: "port5" - } - ports { - id: "port6" - } -} duts { id: "xrd" vendor: CISCO @@ -71,66 +5,6 @@ duts { ports { id: "port1" } - ports { - id: "port2" - } - ports { - id: "port3" - } - ports { - id: "port4" - } - ports { - id: "port5" - } - ports { - id: "port6" - } -} -duts { - id: "e8000" - vendor: CISCO - hardware_model: "8201" - ports { - id: "port1" - } - ports { - id: "port2" - } - ports { - id: "port3" - } - ports { - id: "port4" - } - ports { - id: "port5" - } - ports { - id: "port6" - } -} -duts { - id: "lemming" - vendor: OPENCONFIG - ports { - id: "port1" - } - ports { - id: "port2" - } - ports { - id: "port3" - } - ports { - id: "port4" - } - ports { - id: "port5" - } - ports { - id: "port6" - } } ates { id: "otg" @@ -138,104 +12,8 @@ ates { ports { id: "port1" } - ports { - id: "port2" - } - ports { - id: "port3" - } - ports { - id: "port4" - } - ports { - id: "port5" - } - ports { - id: "port6" - } } links { a: "otg:port1" - b: "ceos:port1" -} -links { - a: "otg:port2" - b: "ncptx:port1" -} -links { - a: "otg:port3" - b: "srl:port1" -} -links { - a: "otg:port4" b: "xrd:port1" -} -links { - a: "otg:port5" - b: "e8000:port1" -} -links { - a: "otg:port6" - b: "lemming:port1" -} -links { - a: "ceos:port2" - b: "ncptx:port2" -} -links { - a: "ceos:port3" - b: "srl:port2" -} -links { - a: "ceos:port4" - b: "xrd:port2" -} -links { - a: "ceos:port5" - b: "e8000:port2" -} -links { - a: "ceos:port6" - b: "lemming:port2" -} -links { - a: "ncptx:port3" - b: "srl:port3" -} -links { - a: "ncptx:port4" - b: "xrd:port3" -} -links { - a: "ncptx:port5" - b: "e8000:port3" -} -links { - a: "ncptx:port6" - b: "lemming:port3" -} -links { - a: "srl:port4" - b: "xrd:port4" -} -links { - a: "srl:port5" - b: "e8000:port4" -} -links { - a: "srl:port6" - b: "lemming:port4" -} -links { - a: "xrd:port5" - b: "e8000:port5" -} -links { - a: "xrd:port6" - b: "lemming:port5" -} -links { - a: "e8000:port6" - b: "lemming:port6" -} - +} \ No newline at end of file diff --git a/cloudbuild/vendors/topology.textproto b/cloudbuild/vendors/topology.textproto index f2b29c6c..373da8b1 100644 --- a/cloudbuild/vendors/topology.textproto +++ b/cloudbuild/vendors/topology.textproto @@ -1,109 +1,10 @@ name: "vendors" -nodes: { - name: "ceos" - vendor: ARISTA - model: "ceos" - config: { - image: "us-west1-docker.pkg.dev/gep-kne/arista/ceos:ga" - file: "ceos.cfg" - } -} -nodes: { - name: "ncptx" - vendor: JUNIPER - model: "ncptx" - config: { - image: "us-west1-docker.pkg.dev/gep-kne/juniper/ncptx:ga" - file: "juniper.cfg" - } - interfaces: { - key: "eth5" - value: { - name: "et-0/0/0:0" - } - } - interfaces: { - key: "eth13" - value: { - name: "et-0/0/1:0" - } - } - interfaces: { - key: "eth21" - value: { - name: "et-0/0/2:0" - } - } - interfaces: { - key: "eth29" - value: { - name: "et-0/0/3:0" - } - } - interfaces: { - key: "eth37" - value: { - name: "et-0/0/4:0" - } - } - interfaces: { - key: "eth41" - value: { - name: "et-0/0/6:0" - } - } -} -nodes: { - name: "srl" - vendor: NOKIA - model: "ixr6e" - config: { - image: "us-west1-docker.pkg.dev/gep-kne/nokia/srlinux:ga" - file: "srl.cfg" - } - interfaces: { - key: "e1-1" - value: { - name: "ethernet-1/1" - } - } - interfaces: { - key: "e1-2" - value: { - name: "ethernet-1/2" - } - } - interfaces: { - key: "e1-3" - value: { - name: "ethernet-1/3" - } - } - interfaces: { - key: "e1-4" - value: { - name: "ethernet-1/4" - } - } - interfaces: { - key: "e1-5" - value: { - name: "ethernet-1/5" - } - } - interfaces: { - key: "e1-6" - value: { - name: "ethernet-1/6" - } - } -} nodes: { name: "xrd" vendor: CISCO model: "xrd" config: { - image: "us-west1-docker.pkg.dev/gep-kne/cisco/xrd:ga" + image: "xrd:latest" file: "cisco_xrd.cfg" } interfaces: { @@ -112,86 +13,6 @@ nodes: { name: "GigabitEthernet0/0/0/0" } } - interfaces: { - key: "eth2" - value: { - name: "GigabitEthernet0/0/0/1" - } - } - interfaces: { - key: "eth3" - value: { - name: "GigabitEthernet0/0/0/2" - } - } - interfaces: { - key: "eth4" - value: { - name: "GigabitEthernet0/0/0/3" - } - } - interfaces: { - key: "eth5" - value: { - name: "GigabitEthernet0/0/0/4" - } - } - interfaces: { - key: "eth6" - value: { - name: "GigabitEthernet0/0/0/5" - } - } -} -nodes: { - name: "8000e" - vendor: CISCO - model: "8201" - config: { - image: "us-west1-docker.pkg.dev/gep-kne/cisco/8000e:ga" - file: "cisco_8000e.cfg" - } - interfaces: { - key: "eth1" - value: { - name: "FourHundredGigE0/0/0/0" - } - } - interfaces: { - key: "eth2" - value: { - name: "FourHundredGigE0/0/0/1" - } - } - interfaces: { - key: "eth3" - value: { - name: "FourHundredGigE0/0/0/2" - } - } - interfaces: { - key: "eth4" - value: { - name: "FourHundredGigE0/0/0/3" - } - } - interfaces: { - key: "eth5" - value: { - name: "FourHundredGigE0/0/0/4" - } - } - interfaces: { - key: "eth6" - value: { - name: "FourHundredGigE0/0/0/5" - } - } -} -nodes: { - name: "lemming" - vendor: OPENCONFIG - model: "LEMMING" } nodes: { name: "otg" @@ -202,132 +23,6 @@ nodes: { links: { a_node: "otg" a_int: "eth1" - z_node: "ceos" - z_int: "eth1" -} -links: { - a_node: "otg" - a_int: "eth2" - z_node: "ncptx" - z_int: "eth5" -} -links: { - a_node: "otg" - a_int: "eth3" - z_node: "srl" - z_int: "e1-1" -} -links: { - a_node: "otg" - a_int: "eth4" z_node: "xrd" z_int: "eth1" -} -links: { - a_node: "otg" - a_int: "eth5" - z_node: "8000e" - z_int: "eth1" -} -links: { - a_node: "otg" - a_int: "eth6" - z_node: "lemming" - z_int: "eth1" -} -# Links from ceos -links: { - a_node: "ceos" - a_int: "eth2" - z_node: "ncptx" - z_int: "eth13" -} -links: { - a_node: "ceos" - a_int: "eth3" - z_node: "srl" - z_int: "e1-2" -} -links: { - a_node: "ceos" - a_int: "eth4" - z_node: "xrd" - z_int: "eth2" -} -links: { - a_node: "ceos" - a_int: "eth5" - z_node: "8000e" - z_int: "eth2" -} -links: { - a_node: "ceos" - a_int: "eth6" - z_node: "lemming" - z_int: "eth2" -} -# Links from ncptx -links: { - a_node: "ncptx" - a_int: "eth21" - z_node: "srl" - z_int: "e1-3" -} -links: { - a_node: "ncptx" - a_int: "eth29" - z_node: "xrd" - z_int: "eth3" -} -links: { - a_node: "ncptx" - a_int: "eth37" - z_node: "8000e" - z_int: "eth3" -} -links: { - a_node: "ncptx" - a_int: "eth41" - z_node: "lemming" - z_int: "eth3" -} -# Links from srl -links: { - a_node: "srl" - a_int: "e1-4" - z_node: "xrd" - z_int: "eth4" -} -links: { - a_node: "srl" - a_int: "e1-5" - z_node: "8000e" - z_int: "eth4" -} -links: { - a_node: "srl" - a_int: "e1-6" - z_node: "lemming" - z_int: "eth4" -} -# Links from xrd -links: { - a_node: "xrd" - a_int: "eth5" - z_node: "8000e" - z_int: "eth5" -} -links: { - a_node: "xrd" - a_int: "eth6" - z_node: "lemming" - z_int: "eth5" -} -# Links from 8000e -links: { - a_node: "8000e" - a_int: "eth6" - z_node: "lemming" - z_int: "eth6" -} - +} \ No newline at end of file diff --git a/topo/node/cisco/cisco.go b/topo/node/cisco/cisco.go index 73eaaf55..c3a64665 100644 --- a/topo/node/cisco/cisco.go +++ b/topo/node/cisco/cisco.go @@ -44,6 +44,7 @@ const ( scrapliPlatformName = "cisco_iosxr" reset8000eCMD = "copy disk0:/startup-config running-config replace" + xrdInterfaceConfig = "/var/opt/cisco/iosxr/xrd/interface_ip_config.txt" // Add the empty echo to work around the copy command not outputting a newline at the end if there is no // change in config. resetXRdCMD = "/pkg/bin/xr_cli \"copy disk0:/startup-config running-config replace\" ; echo \"\"" @@ -617,14 +618,16 @@ func (n *Node) ResetCfg(ctx context.Context) error { var cmd string if n.Proto.Model == ModelXRD { - // Copy startup config from mounted location so it can be applied. This is required since the "copy" - // xr_cli command can only access files on disk 0/1. + // Copy the snooped management interface config from a know location and the startup config from + // the mounted location so it can be applied. This is required to preserve the snooped management + // IP addres and since the "copy" xr_cli command can only access files on disk 0/1. startup_config := n.Proto.Config.Env["XR_EVERY_BOOT_CONFIG"] if startup_config == "" { return status.Errorf(codes.InvalidArgument, "XR_EVERY_BOOT_CONFIG is not set") } // Send an additional return command to make sure any error messages are read. - resp, err := n.cliConn.SendCommands([]string{"cp " + startup_config + " /disk0:/startup-config", ""}) + copyCfgCmd := "cat " + xrdInterfaceConfig + " " + startup_config + " > /disk0:/startup-config" + resp, err := n.cliConn.SendCommands([]string{copyCfgCmd, ""}) if err != nil { return err } diff --git a/topo/node/cisco/testdata/xrd_reset_config_failure b/topo/node/cisco/testdata/xrd_reset_config_failure index 6450c8e2..75f325fe 100644 --- a/topo/node/cisco/testdata/xrd_reset_config_failure +++ b/topo/node/cisco/testdata/xrd_reset_config_failure @@ -1,6 +1,6 @@ [node0_RP0_CPU0:~]$ -[node0_RP0_CPU0:~]$cp /startup.cfg /disk0:/startup-config -cp: cannot stat '/startup.cfg': No such file or directory +[node0_RP0_CPU0:~]$cat /var/opt/cisco/iosxr/xrd/interface_ip_config.txt /startup.cfg > /disk0:/startup-config +cat: /startup.cfg: No such file or directory [node0_RP0_CPU0:~]$ [node0_RP0_CPU0:~]$ [node0_RP0_CPU0:~]$ \ No newline at end of file diff --git a/topo/node/cisco/testdata/xrd_reset_config_failure_invalid b/topo/node/cisco/testdata/xrd_reset_config_failure_invalid index aa76dfeb..59544bba 100644 --- a/topo/node/cisco/testdata/xrd_reset_config_failure_invalid +++ b/topo/node/cisco/testdata/xrd_reset_config_failure_invalid @@ -1,5 +1,5 @@ [node0_RP0_CPU0:~]$ -[node0_RP0_CPU0:~]$cp /startup.cfg /disk0:/startup-config +[node0_RP0_CPU0:~]$cat /var/opt/cisco/iosxr/xrd/interface_ip_config.txt /startup.cfg > /disk0:/startup-config [node0_RP0_CPU0:~]$ [node0_RP0_CPU0:~]$/pkg/bin/xr_cli "copy disk0:/startup-config running-config replace" ; echo "" diff --git a/topo/node/cisco/testdata/xrd_reset_config_success b/topo/node/cisco/testdata/xrd_reset_config_success index 0f93d289..2ce33b4b 100644 --- a/topo/node/cisco/testdata/xrd_reset_config_success +++ b/topo/node/cisco/testdata/xrd_reset_config_success @@ -1,5 +1,5 @@ [node0_RP0_CPU0:~]$ -[node0_RP0_CPU0:~]$cp /startup.cfg /disk0:/startup-config +[node0_RP0_CPU0:~]$cat /var/opt/cisco/iosxr/xrd/interface_ip_config.txt /startup.cfg > /disk0:/startup-config [node0_RP0_CPU0:~]$ [node0_RP0_CPU0:~]$/pkg/bin/xr_cli "copy disk0:/startup-config running-config replace" ; echo ""