def test_colony_lbprofile_max_protobuf_conversion(self): self.colony.name = "riftcolony" nc = self.colony.network_context.add() nc.name = "trafgen" lbprof = [] for i in range(33): lbprof.append(nc.lb_profile.add()) lbprof[i].name = "DiameterLB" + str(i) pbuf = self.colony.to_pbuf() recreated_colony = RwFpathDYang.ConfigColony() recreated_colony.from_pbuf(pbuf) print "Colony : ", self.colony print "Recreated Colony : ", recreated_colony # check the newly created start is identical self.assertEqual(self.colony.name, recreated_colony.name) self.assertEqual(nc.name, recreated_colony.network_context[0].name) print len(recreated_colony.network_context) self.assertEqual(len(recreated_colony.network_context), 1) print len(recreated_colony.network_context[0].lb_profile) self.assertEqual(len(recreated_colony.network_context[0].lb_profile), 32) for i in range(len(recreated_colony.network_context[0].lb_profile)): self.assertEqual( lbprof[i].name, recreated_colony.network_context[0].lb_profile[i].name)
def test_gi_get_pbcmd_from_xpath(self): xpath = "D,/rw-base:colony[rw-base:name='trafgen']" schema = RwFpathDYang.get_schema() pbcmd = RwKeyspec.get_pbcmd_from_xpath(xpath, schema) self.assertTrue(pbcmd) self.assertEqual(pbcmd, RwFpathDYang.ConfigColony().retrieve_descriptor()) xpath = "/rw-base:colony[rw-base:name='trafgen']/rw-fpath:bundle-ether[rw-fpath:name='bundle1']" pbcmd = RwKeyspec.get_pbcmd_from_xpath(xpath, schema) self.assertTrue(pbcmd) self.assertEqual(pbcmd, RwFpathDYang.ConfigColony_BundleEther().retrieve_descriptor()) #container xpath = "/rw-base:colony[rw-base:name='trafgen']/rw-fpath:bundle-ether[rw-fpath:name='bundle1']/rw-fpath:lacp" pbcmd = RwKeyspec.get_pbcmd_from_xpath(xpath, schema) self.assertTrue(pbcmd) self.assertEqual(pbcmd, RwFpathDYang.ConfigColony_BundleEther_Lacp().retrieve_descriptor()) #leaf, should give error xpath = "/rw-base:colony[rw-base:name='trafgen']/rw-fpath:bundle-ether[rw-fpath:name='bundle1']/rw-fpath:open" pbcmd = RwKeyspec.get_pbcmd_from_xpath(xpath, schema) self.assertFalse(pbcmd);
def setUp(self): self.colony = RwFpathDYang.ConfigColony() self.colony1 = RwAppmgrDYang.ConfigColony()
def setUp(self): self.colony = RwFpathDYang.ConfigColony()