Пример #1
0
 def test_create_valid_phydomain(self):
     intf = Interface('eth', '1', '1', '1', '1')
     (phydomain_json, fabric_json, infra_json) = intf.get_json()
     expected_json = ("{'physDomP': {'attributes': {'name': 'allvlans'}, 'c"
                      "hildren': [{'infraRsVlanNs': {'attributes': {'tDn': "
                      "'uni/infra/vlanns-allvlans-static'}, 'children': []}"
                      "}]}}")
     self.assertEqual(str(phydomain_json), expected_json)
Пример #2
0
 def test_create_valid_phydomain(self):
     intf = Interface('eth', '1', '1', '1', '1')
     (phydomain_json, fabric_json, infra_json) = intf.get_json()
     expected_json = ("{'physDomP': {'attributes': {'name': 'allvlans'}, 'c"
                      "hildren': [{'infraRsVlanNs': {'attributes': {'tDn': "
                      "'uni/infra/vlanns-allvlans-static'}, 'children': []}"
                      "}]}}")
     self.assertEqual(str(phydomain_json), expected_json)
Пример #3
0
 def test_adminstate_down(self):
     intf = Interface('eth', '1', '1', '1', '1')
     intf.adminstatus = 'down'
     phys_domain_json, fabric_json, infra_json = intf.get_json()
     expected_json = ("{'fabricOOServicePol': {'children': [{'fabricRsOosPa"
                      "th': {'attributes': {'tDn': 'topology/pod-1/paths-1/"
                      "pathep-[eth1/1]', 'lc': 'blacklist'}, 'children': []"
                      "}}]}}")
     self.assertEqual(str(fabric_json), expected_json)
Пример #4
0
 def test_adminstate_down(self):
     intf = Interface('eth', '1', '1', '1', '1')
     intf.adminstatus = 'down'
     phys_domain_json, fabric_json, infra_json = intf.get_json()
     expected_json = ("{'fabricOOServicePol': {'children': [{'fabricRsOosPa"
                      "th': {'attributes': {'tDn': 'topology/pod-1/paths-1/"
                      "pathep-[eth1/1]', 'lc': 'blacklist'}, 'children': []"
                      "}}]}}")
     self.assertEqual(str(fabric_json), expected_json)
Пример #5
0
 def test_adminstate_up(self):
     intf = Interface('eth', '1', '1', '1', '1')
     intf.adminstatus = 'up'
     phys_domain_json, fabric_json, infra_json = intf.get_json()
     expected_json = ("{'fabricOOServicePol': {'children': [{'fabricRsOosPa"
                      "th': {'attributes': {'dn': 'uni/fabric/outofsvc/rsoo"
                      "sPath-[topology/pod-1/paths-1/pathep-[eth1/1]]', 'st"
                      "atus': 'deleted', 'tDn': 'topology/pod-1/paths-1/pat"
                      "hep-[eth1/1]'}, 'children': []}}]}}")
     self.assertEqual(str(fabric_json), expected_json)
Пример #6
0
 def test_adminstate_up(self):
     intf = Interface('eth', '1', '1', '1', '1')
     intf.adminstatus = 'up'
     phys_domain_json, fabric_json, infra_json = intf.get_json()
     expected_json = ("{'fabricOOServicePol': {'children': [{'fabricRsOosPa"
                      "th': {'attributes': {'dn': 'uni/fabric/outofsvc/rsoo"
                      "sPath-[topology/pod-1/paths-1/pathep-[eth1/1]]', 'st"
                      "atus': 'deleted', 'tDn': 'topology/pod-1/paths-1/pat"
                      "hep-[eth1/1]'}, 'children': []}}]}}")
     self.assertEqual(str(fabric_json), expected_json)
Пример #7
0
    def test_set_speed_1G(self):
        intf = Interface("eth", "1", "1", "1", "1")
        intf.speed = "1G"
        (phys_domain_json, fabric_json, infra_json) = intf.get_json()
        expected_json = (
            "{'infraInfra': {'attributes': {}, 'children': [{'infraNodeP': {'attrib"
            "utes': {'name': '1-1-1-1'}, 'children': [{'infraLeaf"
            "S': {'attributes': {'type': 'range', 'name': '1-1-1-"
            "1'}, 'children': [{'infraNodeBlk': {'attributes': {'"
            "from_': '1', 'name': '1-1-1-1', 'to_': '1'}, 'childr"
            "en': []}}]}}, {'infraRsAccPortP': {'attributes': {'t"
            "Dn': 'uni/infra/accportprof-1-1-1-1'}, 'children': ["
            "]}}]}}, {'infraAccPortP': {'attributes': {'name': '1"
            "-1-1-1'}, 'children': [{'infraHPortS': {'attributes'"
            ": {'type': 'range', 'name': '1-1-1-1'}, 'children': "
            "[{'infraPortBlk': {'attributes': {'toPort': '1', 'fr"
            "omPort': '1', 'fromCard': '1', 'name': '1-1-1-1', 't"
            "oCard': '1'}, 'children': []}}, {'infraRsAccBaseGrp'"
            ": {'attributes': {'tDn': 'uni/infra/funcprof/accport"
            "grp-1-1-1-1'}, 'children': []}}]}}]}}, {'fabricHIfPo"
            "l': {'attributes': {'dn': 'uni/infra/hintfpol-speed1"
            "G', 'autoNeg': 'on', 'speed': '1G', 'name': 'speed1G"
            "'}, 'children': []}}, {'infraFuncP': {'attributes': "
            "{}, 'children': [{'infraAccPortGrp': {'attributes': "
            "{'dn': 'uni/infra/funcprof/accportgrp-1-1-1-1', 'nam"
            "e': '1-1-1-1'}, 'children': [{'infraRsHIfPol': {'att"
            "ributes': {'tnFabricHIfPolName': 'speed1G'}, 'childr"
            "en': []}}, {'infraRsAttEntP': {'attributes': {'tDn':"
            " 'uni/infra/attentp-allvlans'}, 'children': []}}]}}]"
            "}}, {'infraAttEntityP': {'attributes': {'name': 'all"
            "vlans'}, 'children': [{'infraRsDomP': {'attributes':"
            " {'tDn': 'uni/phys-allvlans'}}}]}}, {'fvnsVlanInstP'"
            ": {'attributes': {'name': 'allvlans', 'allocMode': '"
            "static'}, 'children': [{'fvnsEncapBlk': {'attributes"
            "': {'to': 'vlan-4092', 'from': 'vlan-1', 'name': 'en"
            "cap'}}}]}}]}}"
        )

        self.assertEqual(str(infra_json), expected_json)
Пример #8
0
    def test_set_speed_1G(self):
        intf = Interface('eth', '1', '1', '1', '1')
        intf.speed = '1G'
        (phys_domain_json, fabric_json, infra_json) = intf.get_json()
        expected_json = (
            "{'infraInfra': {'attributes': {}, 'children': [{'infraNodeP': {'attrib"
            "utes': {'name': '1-1-1-1'}, 'children': [{'infraLeaf"
            "S': {'attributes': {'type': 'range', 'name': '1-1-1-"
            "1'}, 'children': [{'infraNodeBlk': {'attributes': {'"
            "from_': '1', 'name': '1-1-1-1', 'to_': '1'}, 'childr"
            "en': []}}]}}, {'infraRsAccPortP': {'attributes': {'t"
            "Dn': 'uni/infra/accportprof-1-1-1-1'}, 'children': ["
            "]}}]}}, {'infraAccPortP': {'attributes': {'name': '1"
            "-1-1-1'}, 'children': [{'infraHPortS': {'attributes'"
            ": {'type': 'range', 'name': '1-1-1-1'}, 'children': "
            "[{'infraPortBlk': {'attributes': {'toPort': '1', 'fr"
            "omPort': '1', 'fromCard': '1', 'name': '1-1-1-1', 't"
            "oCard': '1'}, 'children': []}}, {'infraRsAccBaseGrp'"
            ": {'attributes': {'tDn': 'uni/infra/funcprof/accport"
            "grp-1-1-1-1'}, 'children': []}}]}}]}}, {'fabricHIfPo"
            "l': {'attributes': {'dn': 'uni/infra/hintfpol-speed1"
            "G', 'autoNeg': 'on', 'speed': '1G', 'name': 'speed1G"
            "'}, 'children': []}}, {'infraFuncP': {'attributes': "
            "{}, 'children': [{'infraAccPortGrp': {'attributes': "
            "{'dn': 'uni/infra/funcprof/accportgrp-1-1-1-1', 'nam"
            "e': '1-1-1-1'}, 'children': [{'infraRsHIfPol': {'att"
            "ributes': {'tnFabricHIfPolName': 'speed1G'}, 'childr"
            "en': []}}, {'infraRsAttEntP': {'attributes': {'tDn':"
            " 'uni/infra/attentp-allvlans'}, 'children': []}}]}}]"
            "}}, {'infraAttEntityP': {'attributes': {'name': 'all"
            "vlans'}, 'children': [{'infraRsDomP': {'attributes':"
            " {'tDn': 'uni/phys-allvlans'}}}]}}, {'fvnsVlanInstP'"
            ": {'attributes': {'name': 'allvlans', 'allocMode': '"
            "static'}, 'children': [{'fvnsEncapBlk': {'attributes"
            "': {'to': 'vlan-4092', 'from': 'vlan-1', 'name': 'en"
            "cap'}}}]}}]}}")

        self.assertEqual(str(infra_json), expected_json)
Пример #9
0
 def test_set_speed_10G(self):
     intf = Interface("eth", "1", "101", "1", "5")
     intf.speed = "10G"
     (phys_domain_json, fabric_json, infra_json) = intf.get_json()
     expected_json = (
         "{'infraInfra': {'attributes': {}, 'children': [{'infraNodeP': {'attrib"
         "utes': {'name': '1-101-1-5'}, 'children': [{'infraLe"
         "afS': {'attributes': {'type': 'range', 'name': '1-10"
         "1-1-5'}, 'children': [{'infraNodeBlk': {'attributes'"
         ": {'from_': '101', 'name': '1-101-1-5', 'to_': '101'"
         "}, 'children': []}}]}}, {'infraRsAccPortP': {'attrib"
         "utes': {'tDn': 'uni/infra/accportprof-1-101-1-5'}, '"
         "children': []}}]}}, {'infraAccPortP': {'attributes':"
         " {'name': '1-101-1-5'}, 'children': [{'infraHPortS':"
         " {'attributes': {'type': 'range', 'name': '1-101-1-5"
         "'}, 'children': [{'infraPortBlk': {'attributes': {'t"
         "oPort': '5', 'fromPort': '5', 'fromCard': '1', 'name"
         "': '1-101-1-5', 'toCard': '1'}, 'children': []}}, {'"
         "infraRsAccBaseGrp': {'attributes': {'tDn': 'uni/infr"
         "a/funcprof/accportgrp-1-101-1-5'}, 'children': []}}]"
         "}}]}}, {'fabricHIfPol': {'attributes': {'dn': 'uni/i"
         "nfra/hintfpol-speed10G', 'autoNeg': 'on', 'speed': '"
         "10G', 'name': 'speed10G'}, 'children': []}}, {'infra"
         "FuncP': {'attributes': {}, 'children': [{'infraAccPo"
         "rtGrp': {'attributes': {'dn': 'uni/infra/funcprof/ac"
         "cportgrp-1-101-1-5', 'name': '1-101-1-5'}, 'children"
         "': [{'infraRsHIfPol': {'attributes': {'tnFabricHIfPo"
         "lName': 'speed10G'}, 'children': []}}, {'infraRsAttE"
         "ntP': {'attributes': {'tDn': 'uni/infra/attentp-allv"
         "lans'}, 'children': []}}]}}]}}, {'infraAttEntityP': "
         "{'attributes': {'name': 'allvlans'}, 'children': [{'"
         "infraRsDomP': {'attributes': {'tDn': 'uni/phys-allvl"
         "ans'}}}]}}, {'fvnsVlanInstP': {'attributes': {'name'"
         ": 'allvlans', 'allocMode': 'static'}, 'children': [{"
         "'fvnsEncapBlk': {'attributes': {'to': 'vlan-4092', '"
         "from': 'vlan-1', 'name': 'encap'}}}]}}]}}"
     )
     self.assertEqual(str(infra_json), expected_json)
Пример #10
0
 def test_set_speed_10G(self):
     intf = Interface('eth', '1', '101', '1', '5')
     intf.speed = '10G'
     (phys_domain_json, fabric_json, infra_json) = intf.get_json()
     expected_json = (
         "{'infraInfra': {'attributes': {}, 'children': [{'infraNodeP': {'attrib"
         "utes': {'name': '1-101-1-5'}, 'children': [{'infraLe"
         "afS': {'attributes': {'type': 'range', 'name': '1-10"
         "1-1-5'}, 'children': [{'infraNodeBlk': {'attributes'"
         ": {'from_': '101', 'name': '1-101-1-5', 'to_': '101'"
         "}, 'children': []}}]}}, {'infraRsAccPortP': {'attrib"
         "utes': {'tDn': 'uni/infra/accportprof-1-101-1-5'}, '"
         "children': []}}]}}, {'infraAccPortP': {'attributes':"
         " {'name': '1-101-1-5'}, 'children': [{'infraHPortS':"
         " {'attributes': {'type': 'range', 'name': '1-101-1-5"
         "'}, 'children': [{'infraPortBlk': {'attributes': {'t"
         "oPort': '5', 'fromPort': '5', 'fromCard': '1', 'name"
         "': '1-101-1-5', 'toCard': '1'}, 'children': []}}, {'"
         "infraRsAccBaseGrp': {'attributes': {'tDn': 'uni/infr"
         "a/funcprof/accportgrp-1-101-1-5'}, 'children': []}}]"
         "}}]}}, {'fabricHIfPol': {'attributes': {'dn': 'uni/i"
         "nfra/hintfpol-speed10G', 'autoNeg': 'on', 'speed': '"
         "10G', 'name': 'speed10G'}, 'children': []}}, {'infra"
         "FuncP': {'attributes': {}, 'children': [{'infraAccPo"
         "rtGrp': {'attributes': {'dn': 'uni/infra/funcprof/ac"
         "cportgrp-1-101-1-5', 'name': '1-101-1-5'}, 'children"
         "': [{'infraRsHIfPol': {'attributes': {'tnFabricHIfPo"
         "lName': 'speed10G'}, 'children': []}}, {'infraRsAttE"
         "ntP': {'attributes': {'tDn': 'uni/infra/attentp-allv"
         "lans'}, 'children': []}}]}}]}}, {'infraAttEntityP': "
         "{'attributes': {'name': 'allvlans'}, 'children': [{'"
         "infraRsDomP': {'attributes': {'tDn': 'uni/phys-allvl"
         "ans'}}}]}}, {'fvnsVlanInstP': {'attributes': {'name'"
         ": 'allvlans', 'allocMode': 'static'}, 'children': [{"
         "'fvnsEncapBlk': {'attributes': {'to': 'vlan-4092', '"
         "from': 'vlan-1', 'name': 'encap'}}}]}}]}}")
     self.assertEqual(str(infra_json), expected_json)
Пример #11
0
 def test_create_valid(self):
     intf = Interface('eth', '1', '1', '1', '1')
     (phydomain_json, fabric_json, infra_json) = intf.get_json()
     expected_json = ("{'infraInfra': {'attributes': {}, 'children': [{'infraNodeP': {'attrib"
                      "utes': {'name': '1-1-1-1'}, 'children': [{'infraLeaf"
                      "S': {'attributes': {'type': 'range', 'name': '1-1-1-"
                      "1'}, 'children': [{'infraNodeBlk': {'attributes': {'"
                      "from_': '1', 'name': '1-1-1-1', 'to_': '1'}, 'childr"
                      "en': []}}]}}, {'infraRsAccPortP': {'attributes': {'t"
                      "Dn': 'uni/infra/accportprof-1-1-1-1'}, 'children': ["
                      "]}}]}}, {'infraAccPortP': {'attributes': {'name': '1"
                      "-1-1-1'}, 'children': [{'infraHPortS': {'attributes'"
                      ": {'type': 'range', 'name': '1-1-1-1'}, 'children': "
                      "[{'infraPortBlk': {'attributes': {'toPort': '1', 'fr"
                      "omPort': '1', 'fromCard': '1', 'name': '1-1-1-1', 't"
                      "oCard': '1'}, 'children': []}}, {'infraRsAccBaseGrp'"
                      ": {'attributes': {'tDn': 'uni/infra/funcprof/accport"
                      "grp-1-1-1-1'}, 'children': []}}]}}]}}, {'fabricHIfPo"
                      "l': {'attributes': {'dn': 'uni/infra/hintfpol-speed1"
                      "0G', 'autoNeg': 'on', 'speed': '10G', 'name': 'speed"
                      "10G'}, 'children': []}}, {'infraFuncP': {'attributes"
                      "': {}, 'children': [{'infraAccPortGrp': {'attributes"
                      "': {'dn': 'uni/infra/funcprof/accportgrp-1-1-1-1', '"
                      "name': '1-1-1-1'}, 'children': [{'infraRsHIfPol': {'"
                      "attributes': {'tnFabricHIfPolName': 'speed10G'}, 'ch"
                      "ildren': []}}, {'infraRsAttEntP': {'attributes': {'t"
                      "Dn': 'uni/infra/attentp-allvlans'}, 'children': []}}"
                      "]}}]}}, {'infraAttEntityP': {'attributes': {'name': "
                      "'allvlans'}, 'children': [{'infraRsDomP': {'attribut"
                      "es': {'tDn': 'uni/phys-allvlans'}}}]}}, {'fvnsVlanIn"
                      "stP': {'attributes': {'name': 'allvlans', 'allocMode"
                      "': 'static'}, 'children': [{'fvnsEncapBlk': {'attrib"
                      "utes': {'to': 'vlan-4092', 'from': 'vlan-1', 'name':"
                      " 'encap'}}}]}}]}}")
     self.assertTrue(intf is not None)
     self.assertEqual(str(infra_json), expected_json)
Пример #12
0
 def test_adminstate_not_set(self):
     intf = Interface('eth', '1', '1', '1', '1')
     intf.adminstate = ''
     # phys_domain_url, fabric_url, infra_url = intf.get_url()
     phys_domain_json, fabric_json, infra_json = intf.get_json()
     self.assertIsNone(fabric_json)
Пример #13
0
 def test_adminstate_not_set(self):
     intf = Interface('eth', '1', '1', '1', '1')
     intf.adminstate = ''
     # phys_domain_url, fabric_url, infra_url = intf.get_url()
     phys_domain_json, fabric_json, infra_json = intf.get_json()
     self.assertIsNone(fabric_json)