def runTest(self):
        host_segment_cfg = {
            "deviceId":
            cfg.leaf0['id'],
            "vlanId":
            80,
            "subnet":
            '192.168.80.254/26',
            "vrf":
            0,
            "ports": [
                str(cfg.leaf0['portC'].number) + '/u',
                str(cfg.leaf0['portD'].number) + '/u'
            ]
        }

        sf = StaticFabric().create(HostSegment(host_segment_cfg))

        host[0]['ip'] = '192.168.80.193'
        host[1]['ip'] = '192.168.80.194'

        h0 = Host(host[0]).set_ip(netmask='255.255.255.192')
        h1 = Host(host[1]).set_ip(netmask='255.255.255.192')

        assert ('success' == h0.ping(host[1]['ip']))
        assert ('success' == h1.ping(host[0]['ip']))

        sf.delete()
    def runTest(self):
        sf = StaticFabric()

        assert (sf.retrieve_prefix()['linkPrefix'] == '10.10.0.0/16')
        assert (sf.retrieve_prefix()['loopbackPrefix'] == '10.10.1.0/24')

        sf.update_prefix(link="192.168.3.0/16", loopback="192.168.1.0/24")

        assert (sf.retrieve_prefix()['linkPrefix'] == "192.168.3.0/16")
        assert (sf.retrieve_prefix()['loopbackPrefix'] == "192.168.1.0/24")

        sf.update_prefix(link="10.10.0.0/16", loopback="10.10.1.0/24")
    def runTest(self):
        cfg.leaf0['portC'].tagged(True)
        cfg.leaf0['portD'].tagged(True)

        host_segment_cfg1 = {
            "deviceId": cfg.leaf0['id'],
            "vlanId": 80,
            "subnet": '192.168.80.254/26',
            "vrf": 0,
            "ports": [cfg.leaf0['portC'].name]
        }
        host_segment_cfg2 = {
            "deviceId": cfg.leaf0['id'],
            "vlanId": 90,
            "subnet": '192.168.90.254/26',
            "vrf": 0,
            "ports": [cfg.leaf0['portD'].name]
        }

        sf = (StaticFabric().create(HostSegment(host_segment_cfg1)).create(
            HostSegment(host_segment_cfg2)))

        host[0]['ip'] = '192.168.80.193'
        host[1]['ip'] = '192.168.90.194'

        h0 = Host(host[0]).set_ip(netmask='255.255.255.192', vlan=80)
        h1 = Host(host[1]).set_ip(netmask='255.255.255.192', vlan=90)

        assert ('success' == h0.ping(host[1]['ip']))
        assert ('success' == h1.ping(host[0]['ip']))

        sf.delete()
    def runTest(self):
        host_segment_cfg1 = {
            "deviceId": cfg.leaf0['id'],
            "vlanId": 80,
            "subnet": '192.168.80.254/26',
            "vrf": 0,
            "ports": [cfg.leaf0['portC'].name]
        }
        host_segment_cfg2 = {
            "deviceId": cfg.leaf1['id'],
            "vlanId": 100,
            "subnet": '192.168.100.254/26',
            "vrf": 0,
            "ports": [cfg.leaf1['portC'].name]
        }

        sf = (StaticFabric().create(HostSegment(host_segment_cfg1)).create(
            HostSegment(host_segment_cfg2)))

        host[0]['ip'] = '192.168.80.193'
        host[2]['ip'] = '192.168.100.195'

        h0 = Host(host[0]).set_ip(netmask='255.255.255.192')
        h2 = Host(host[2]).set_ip(netmask='255.255.255.192')

        assert ('success' == h0.ping(host[2]['ip']))
        assert ('success' == h2.ping(host[0]['ip']))

        sf.delete()
    def runTest(self):
        host_segment_cfg = {
            "deviceId": cfg.leaf0['id'],
            "vlanId": 80,
            "subnet": '192.168.80.254/26',
            "vrf": 0,
            "ports": [cfg.leaf0['portC'].name]
        }

        sf = StaticFabric()

        assert (sf.retrieve_host_segment() == [])

        sf.create(HostSegment(host_segment_cfg))

        assert (sf.retrieve_host_segment()[0]['deviceId'] == cfg.leaf0['id'])
        assert (sf.retrieve_host_segment()[0]['vlanId'] == 80)
        assert (sf.retrieve_host_segment()[0]['subnet'] == '192.168.80.254/26')
        assert (sf.retrieve_host_segment()[0]['vrf'] == 0)
        assert (sf.retrieve_host_segment()[0]['ports'] == [
            cfg.leaf0['portC'].name
        ])

        sf.delete()

        assert (sf.retrieve_host_segment() == [])

        update_host_segment_cfg = {
            "deviceId": cfg.leaf0['id'],
            "vlanId": 80,
            "ports": ['10/u']
        }

        sf.create(HostSegment(host_segment_cfg))
        sf.update_host_segment(HostSegment(update_host_segment_cfg))

        assert (sf.retrieve_host_segment()[0]['ports'] == ['10/u'])

        sf.delete()
 def setup(cls):
     sf = StaticFabric()
     sf.delete()