def test0200(self): xpath = ("/local-routes/static-routes/static[prefix=%s]/" "next-hops/next-hop[index=%d]/config") % ( self.prefix, self.index) resp_val = self.gNMIGetJson(xpath) self.assertJsonModel( resp_val, self.nh.config, 'gNMI Get on the /config container does not match model') want = json.loads( schema.removeOpenConfigPrefix( pybindJSON.dumps(self.nh.config, mode='ietf'))) self.assertJsonCmp(resp_val, want)
def test0200(self): xpath = ("/interfaces/interface[name=%s]/subinterfaces/" "subinterface[index=%d]/ipv4/addresses" "/address[ip=%s]/config") % (self.interface, self.index, self.address) resp_val = self.gNMIGetJson(xpath) self.assertJsonModel( resp_val, self.addr.config, 'gNMI Get on the /config container does not match model') want = json.loads( schema.removeOpenConfigPrefix( pybindJSON.dumps(self.addr.config, mode='ietf'))) self.assertJsonCmp(resp_val, want)
def test0300(self): xpath = ("/local-routes/static-routes/static[prefix=%s]/" "next-hops/next-hop[index=%d]/state") % ( self.prefix, self.index) resp_val = self.gNMIGetJson(xpath) self.nh.state._set_index(self.index) self.nh.state._set_next_hop(self.next_hop) if self.metric is not None: self.nh.state._set_metric(self.metric) self.assertJsonModel( resp_val, self.nh.state, 'gNMI Get on the /state container does not match model') want = json.loads( schema.removeOpenConfigPrefix( pybindJSON.dumps(self.nh.state, mode='ietf'))) self.assertJsonCmp(resp_val, want)
def test0300(self): xpath = ("/interfaces/interface[name=%s]/subinterfaces/" "subinterface[index=%d]/ipv4/addresses" "/address[ip=%s]/state") % (self.interface, self.index, self.address) resp_val = self.gNMIGetJson(xpath) self.assertJsonModel( resp_val, 'interfaces.interface.subinterfaces.subinterface.ipv4.addresses.' 'address.state.state', 'gNMI Get on the /state container does not match model') ste = oc_addresses.address.state.state() ste._set_ip(self.address) ste._set_prefix_length(self.prefix_length) want = json.loads( schema.removeOpenConfigPrefix(pybindJSON.dumps(ste, mode='ietf'))) self.assertJsonCmp(resp_val, want)
def test0200(self): xpath = ("/interfaces/interface[name=%s]/subinterfaces/" "subinterface[index=%d]/ipv4/addresses" "/address[ip=%s]/config") % (self.interface, self.index, self.address) resp_val = self.gNMIGetJson(xpath) self.assertJsonModel( resp_val, 'interfaces.interface.subinterfaces.subinterface.ipv4.addresses.' 'address.config.config', 'gNMI Get on the /config container does not match model') cfg = oc_addresses.address.config.config() cfg.ip = self.address cfg.prefix_length = self.prefix_length want = json.loads( schema.removeOpenConfigPrefix(pybindJSON.dumps(cfg, mode='ietf'))) self.assertJsonCmp(resp_val, want)
def test0100(self): """""" xpath = ("/interfaces/interface[name=%s]/subinterfaces/" "subinterface[index=%d]/ipv4/addresses/" "address[ip=%s]/config") % (self.interface, self.index, self.address) resp_val = self.gNMIGetJson(xpath) iface = oc_interfaces().interfaces.interface.add(self.interface) subif = iface.subinterfaces.subinterface.add(self.index) if self.index: subif.vlan.config.vlan_id = self.index addr = subif.ipv4.addresses.address.add(self.address) addr.config.ip = self.address addr.config.prefix_length = self.prefix_length self.assertJsonModel( resp_val, addr.config, 'gNMI Get on the /config container does not match model') want = json.loads( schema.removeOpenConfigPrefix( pybindJSON.dumps(addr.config, mode='ietf'))) self.assertJsonCmp(resp_val, want)
def test0100(self): """""" xpath = ("/local-routes/static-routes/static[prefix=%s]" "/next-hops/next-hop[index=%d]/config") % ( self.prefix, self.index) cfg = openconfig_local_routing().local_routes.static_routes.static.\ add(prefix=self.prefix).next_hops.next_hop.add(index=self.index).\ config.config() cfg._set_index(self.index) cfg._set_next_hop(self.next_hop) if self.metric is not None: cfg._set_metric(self.metric) resp_val = self.gNMIGetJson(xpath) self.assertJsonModel( resp_val, cfg, 'gNMI Get on the /config container does not match model') want = json.loads( schema.removeOpenConfigPrefix( pybindJSON.dumps(cfg, mode='ietf'))) self.assertJsonCmp(resp_val, want)