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()
Exemple #2
0
    def runTest(self):
        host0['ip'] = '192.168.80.118'
        host1['ip'] = '192.168.90.119'

        h0 = Host(host0).set_ip()
        h1 = Host(host1).set_ip()

        host_vlan_cfg1 = {
            'deviceId': cfg.sw46_185['id'],
            'vlanId': 70,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_185['front_port_A']]
        }

        host_vlan_cfg2 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': 70,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_188['front_port_A']]
        }

        sr1 = (StaticRouting().add_rest_switch_vlan(
            cfg.sw67_205['id'], 70, "192.168.80.254/24",
            ["192.168.90.254/24"]).add_host_vlan(host_vlan_cfg1).add_host_vlan(
                host_vlan_cfg2).build())

        assert ('success' == h0.ping(host1['ip']))
        assert ('success' == h1.ping(host0['ip']))
    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):
        # no vlan test
        host0['ip'] = '192.168.0.118'
        host1['ip'] = '192.168.0.119'
        host3['ip'] = '192.168.0.120'
        host4['ip'] = '192.168.0.83'
        host5['ip'] = '192.168.0.63'

        h0 = Host(host0).set_ip()
        h1 = Host(host1).set_ip()
        h3 = Host(host3).set_ip()
        h4 = Host(host4).set_ip()
        h5 = Host(host5).set_ip()

        assert ('success' == h4.ping(host0['ip']))
        assert ('success' == h4.ping(host1['ip']))
        assert ('success' == h4.ping(host3['ip']))
        assert ('success' == h4.ping(host5['ip']))

        # vlan test
        vlan_id = 155
        host_vlan_cfg1 = {
            'deviceId': cfg.sw46_126['id'],
            'vlanId': vlan_id,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_126['front_port_B']]
        }

        host_vlan_cfg2 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': vlan_id,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_188['front_port_A']]
        }

        host_vlan_cfg3 = {
            'deviceId': cfg.sw46_185['id'],
            'vlanId': vlan_id,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_185['front_port_A']]
        }

        host_vlan_cfg4 = {
            'deviceId': cfg.sw46_223['id'],
            'vlanId': vlan_id,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_223['front_port_A']]
        }

        sr1 = (StaticRouting().add_switch_vlan(
            cfg.sw67_205['id'], vlan_id, ["192.168.0.254/24"]).add_host_vlan(
                host_vlan_cfg1).add_host_vlan(host_vlan_cfg2).add_host_vlan(
                    host_vlan_cfg3).add_host_vlan(host_vlan_cfg4).build())

        assert ('success' == h4.ping(host0['ip']))
        assert ('success' == h4.ping(host1['ip']))
        assert ('success' == h4.ping(host3['ip']))
Exemple #6
0
    def runTest(self):
        s1_vlan_id = 10
        s2_vlan_id = 30
        ports = sorted(config["port_map"].keys())
        segment_ip_list = [(['192.168.10.254'], ['192.168.30.254'])]

        for (s1_ip, s2_ip) in segment_ip_list:
            t1 = (Tenant('t1').segment(
                's1', 'vlan', s1_ip, s1_vlan_id).segment_member(
                    SegmentMember('s1', cfg.leaf0['id']).ports([
                        cfg.leaf0['portC'].name
                    ])).segment('s2', 'vlan', s2_ip,
                                s2_vlan_id).segment_member(
                                    SegmentMember('s2', cfg.leaf1['id']).ports(
                                        [cfg.leaf1['portC'].name])).build())

            lrouter = (LogicalRouter('r1', 't1').interfaces(['s1',
                                                             's2']).build())

            host[0]['ip'] = '192.168.10.118'
            host[2]['ip'] = '192.168.30.63'

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

            assert ('success' == h0.ping(host[2]['ip']))
    def runTest(self):
        host2['ip'] = '192.168.5.103'
        host3['ip'] = '192.168.253.120'

        h2 = Host(host2).set_ip(vlan=5)
        h3 = Host(host3).set_ip(vlan=253)

        host_vlan_cfg1 = {
            'deviceId': cfg.sw46_185['id'],
            'vlanId': 5,
            'tagPorts': [cfg.sw46_185['front_port_B']],
            'untagPorts': []
        }

        host_vlan_cfg2 = {
            'deviceId': cfg.sw46_223['id'],
            'vlanId': 253,
            'tagPorts': [cfg.sw46_223['front_port_A']],
            'untagPorts': []
        }

        sr1 = (StaticRouting().add_switch_vlan(cfg.sw67_205['id'], 5, [
            "192.168.5.254/24"
        ]).add_switch_vlan(cfg.sw67_205['id'], 253, [
            "192.168.253.254/24"
        ]).add_host_vlan(host_vlan_cfg1).add_host_vlan(host_vlan_cfg2).build())

        assert ('success' == h2.ping(host3['ip']))
Exemple #8
0
    def runTest(self):
        s1_vlan_id = 10
        s2_vlan_id = 20
        s1_ip = '192.168.10.254'
        s2_ip = '192.168.20.254'
        ports = sorted(config["port_map"].keys())

        t1 = (Tenant('t1').segment(
            's1', 'vlan', [s1_ip], s1_vlan_id).segment_member(
                SegmentMember('s1', cfg.leaf0['id']).ports([
                    cfg.leaf0['portC'].name
                ])).segment('s2', 'vlan', [s2_ip], s2_vlan_id).segment_member(
                    SegmentMember('s2', cfg.leaf0['id']).ports(
                        [cfg.leaf0['portD'].name])).segment_member(
                            SegmentMember('s2', cfg.leaf1['id']).ports([
                                cfg.leaf1['portC'].name,
                                cfg.leaf1['portD'].name
                            ])).build())

        lrouter = (LogicalRouter('r1', 't1').interfaces(['s1', 's2']).build())

        host[0]['ip'] = '192.168.10.118'
        host[1]['ip'] = '192.168.20.117'
        host[2]['ip'] = '192.168.20.103'

        h0 = Host(host[0]).set_ip()
        h1 = Host(host[1]).set_ip()
        h2 = Host(host[2]).set_ip()

        assert ('success' == h0.ping(host[1]['ip']))
        assert ('success' == h0.ping(host[2]['ip']))
Exemple #9
0
    def runTest(self):
        legacy_switch_same_vlan_different_subnet_setting()

        host0['ip'] = '192.168.90.118'
        host6['ip'] = '192.168.100.115'
        host7['ip'] = '192.168.110.30'

        h0 = Host(host0).set_ip()
        h6 = Host(host6).set_ip()
        h7 = Host(host7).set_ip()

        host_vlan_cfg1 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': 80,
            'tagPorts': [cfg.sw46_188['front_port_B']],
            'untagPorts': [cfg.sw46_188['front_port_A']]
        }

        sr1 = (StaticRouting().add_rest_switch_vlan(
            cfg.sw67_205['id'], 80, "192.168.90.254/24",
            ["192.168.100.254/24", "192.168.110.254/24"
             ]).add_host_vlan(host_vlan_cfg1).build())

        assert ('success' == h7.ping(host6['ip']))
        assert ('success' == h7.ping(host0['ip']))
    def runTest(self):
        host1_vlan = 8
        host2_vlan = 20

        host_vlan_cfg1 = {
            'deviceId': cfg.sw46_185['id'],
            'vlanId': host1_vlan,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_185['front_port_A']]
        }

        host_vlan_cfg2 = {
            'deviceId': cfg.sw46_185['id'],
            'vlanId': host2_vlan,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_185['front_port_B']]
        }

        sr1 = (StaticRouting().add_switch_vlan(
            cfg.sw67_205['id'],
            host1_vlan, ["192.168.8.254/24"]).add_switch_vlan(
                cfg.sw67_205['id'], host2_vlan,
                ["192.168.20.254/24"]).add_host_vlan(
                    host_vlan_cfg1).add_host_vlan(host_vlan_cfg2).build())

        host1['ip'] = '192.168.8.119'
        host2['ip'] = '192.168.20.103'

        h1 = Host(host1).set_ip()
        h2 = Host(host2).set_ip()

        assert ('success' == h1.ping(host2['ip']))

        sr1.del_host_vlan(cfg.sw46_185['id'], 8)

        host_vlan_cfg1['vlanId'] = 18

        sr2 = (StaticRouting().add_switch_vlan(
            cfg.sw67_205['id'], 18,
            ["192.168.18.254/24"]).add_host_vlan(host_vlan_cfg1).build())

        host1['ip'] = '192.168.18.119'

        h1 = Host(host1).set_ip()

        assert ('success' == h2.ping(host1['ip']))
Exemple #11
0
    def runTest(self):
        legacy_switch_tag_setting()

        host3['ip'] = '192.168.253.120'
        host5['ip'] = '192.168.10.63'
        host6['ip'] = '192.168.60.115'

        h3 = Host(host3).set_ip()
        h5 = Host(host5).set_ip(vlan=10)
        h6 = Host(host6).set_ip(vlan=60)

        host_vlan_cfg1 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': 60,
            'tagPorts': [cfg.sw46_188['front_port_B']],
            'untagPorts': []
        }

        host_vlan_cfg2 = {
            'deviceId': cfg.sw46_223['id'],
            'vlanId': 253,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_223['front_port_A']]
        }

        host_vlan_cfg3 = {
            'deviceId': cfg.sw46_126['id'],
            'vlanId': 10,
            'tagPorts': [cfg.sw46_126['front_port_A']],
            'untagPorts': []
        }

        sr1 = (StaticRouting().add_rest_switch_vlan(
            cfg.sw67_205['id'], 253,
            "192.168.253.254/24", []).add_rest_switch_vlan(
                cfg.sw67_205['id'], 60,
                "192.168.60.254/24", []).add_rest_switch_vlan(
                    cfg.sw67_205['id'], 10, "192.168.10.254/24",
                    []).add_host_vlan(host_vlan_cfg1).add_host_vlan(
                        host_vlan_cfg2).add_host_vlan(host_vlan_cfg3).build())

        assert ('success' == h5.ping(host3['ip']))
        assert ('success' == h6.ping(host3['ip']))
    def runTest(self):
        telnet_and_execute(cfg.legacy_1['mgmtIpAddress'], untag_cmd_list)

        host3['ip'] = '192.168.253.120'
        host5['ip'] = '192.168.10.63'
        host6['ip'] = '192.168.60.115'

        h3 = Host(host3).set_ip()
        h5 = Host(host5).set_ip()
        h6 = Host(host6).set_ip()

        host_vlan_cfg1 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': 60,
            'tagPorts': [cfg.sw46_188['front_port_B']],
            'untagPorts': []
        }

        host_vlan_cfg2 = {
            'deviceId': cfg.sw46_223['id'],
            'vlanId': 253,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_223['front_port_A']]
        }

        host_vlan_cfg3 = {
            'deviceId': cfg.sw46_126['id'],
            'vlanId': 10,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_126['front_port_A']]
        }

        sr1 = (StaticRouting().add_switch_vlan(
            cfg.sw67_205['id'], 253, ["192.168.253.254/24"]).add_switch_vlan(
                cfg.sw67_205['id'], 60, ["192.168.60.254/24"]).add_switch_vlan(
                    cfg.sw67_205['id'], 10,
                    ["192.168.10.254/24"
                     ]).add_host_vlan(host_vlan_cfg1).add_host_vlan(
                         host_vlan_cfg2).add_host_vlan(host_vlan_cfg3).build())

        assert ('success' == h5.ping(host3['ip']))
        assert ('success' == h6.ping(host3['ip']))
Exemple #13
0
    def runTest(self):
        # legacy_switch_untag_setting()

        host0['ip'] = '192.168.60.118'
        host6['ip'] = '192.168.60.115'
        host7['ip'] = '192.168.60.30'

        h0 = Host(host0).set_ip()
        h6 = Host(host6).set_ip()
        h7 = Host(host7).set_ip()

        assert ('success' == h7.ping(host6['ip']))
        assert ('success' == h7.ping(host0['ip']))
    def runTest(self):
        vlan_id = 30
        ports = sorted(config["port_map"].keys())

        t1 = (
            Tenant('t1')
            .segment('s1', 'vlan', ['192.168.30.254'], vlan_id)
            .segment_member(SegmentMember('s1', cfg.leaf0['id']).ports([cfg.leaf0['portC'].name, cfg.leaf0['portD'].name]))
            .segment_member(SegmentMember('s1', cfg.leaf1['id']).ports([cfg.leaf1['portC'].name]))
            .build()
        )

        host[0]['ip'] = '192.168.30.1'
        host[1]['ip'] = '192.168.30.2'
        host[2]['ip'] = '192.168.30.3'

        h0 = Host(host[0]).set_ip(vlan=vlan_id)
        h1 = Host(host[1]).set_ip(vlan=vlan_id)
        h2 = Host(host[2]).set_ip(vlan=vlan_id)

        assert('success' == h0.ping(host[1]['ip']))
        assert('success' == h0.ping(host[2]['ip']))
        assert('success' == h2.ping(host[1]['ip']))
Exemple #15
0
    def runTest(self):
        host1['ip'] = '192.168.60.119'
        host2['ip'] = '192.168.70.103'

        h1 = Host(host1).set_ip()
        h2 = Host(host2).set_ip()

        host_vlan_cfg1 = {
            'deviceId':
            cfg.sw46_185['id'],
            'vlanId':
            50,
            'tagPorts': [],
            'untagPorts':
            [cfg.sw46_185['front_port_A'], cfg.sw46_185['front_port_B']]
        }

        sr1 = (StaticRouting().add_rest_switch_vlan(
            cfg.sw67_205['id'], 50, "192.168.60.254/24",
            ["192.168.70.254/24"]).add_host_vlan(host_vlan_cfg1).build())

        assert ('success' == h1.ping(host2['ip']))
        assert ('success' == h2.ping(host1['ip']))
    def runTest(self):
        telnet_and_execute(cfg.legacy_1['mgmtIpAddress'], tag_cmd_list)

        host0['ip'] = '192.168.60.118'
        host6['ip'] = '192.168.60.115'
        host7['ip'] = '192.168.70.30'

        h0 = Host(host0).set_ip(vlan=60)
        h6 = Host(host6).set_ip(vlan=60)
        h7 = Host(host7).set_ip(vlan=70)

        host_vlan_cfg1 = {
            'deviceId':
            cfg.sw46_188['id'],
            'vlanId':
            60,
            'tagPorts':
            [cfg.sw46_188['front_port_B'], cfg.sw46_188['front_port_A']],
            'untagPorts': []
        }

        host_vlan_cfg2 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': 70,
            'tagPorts': [cfg.sw46_188['front_port_B']],
            'untagPorts': []
        }

        sr1 = (StaticRouting().add_switch_vlan(cfg.sw67_205['id'], 60, [
            "192.168.60.254/24"
        ]).add_switch_vlan(cfg.sw67_205['id'], 70, [
            "192.168.70.254/24"
        ]).add_host_vlan(host_vlan_cfg1).add_host_vlan(host_vlan_cfg2).build())

        assert ('success' == h7.ping(host6['ip']))
        assert ('success' == h6.ping(host0['ip']))
Exemple #17
0
    def runTest(self):
        legacy_switch_untag_setting()

        host0['ip'] = '192.168.90.118'
        host6['ip'] = '192.168.60.115'
        host7['ip'] = '192.168.70.30'

        h0 = Host(host0).set_ip()
        h6 = Host(host6).set_ip()
        h7 = Host(host7).set_ip()

        host_vlan_cfg1 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': 60,
            'tagPorts': [cfg.sw46_188['front_port_B']],
            'untagPorts': []
        }

        host_vlan_cfg2 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': 70,
            'tagPorts': [cfg.sw46_188['front_port_B']],
            'untagPorts': []
        }

        host_vlan_cfg3 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': 90,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_188['front_port_A']]
        }

        sr1 = (StaticRouting().add_rest_switch_vlan(
            cfg.sw67_205['id'], 60,
            "192.168.60.254/24", []).add_rest_switch_vlan(
                cfg.sw67_205['id'], 70,
                "192.168.70.254/24", []).add_rest_switch_vlan(
                    cfg.sw67_205['id'], 90, "192.168.90.254/24",
                    []).add_host_vlan(host_vlan_cfg1).add_host_vlan(
                        host_vlan_cfg2).add_host_vlan(host_vlan_cfg3).build())

        assert ('success' == h7.ping(host6['ip']))
        assert ('success' == h7.ping(host0['ip']))
Exemple #18
0
    def runTest(self):
        s1_vlan_id = 10
        ports = sorted(config["port_map"].keys())

        cfg.leaf0['portC'].tagged(True)
        cfg.leaf0['portD'].tagged(True)

        t1 = (Tenant('t1').segment(
            's1', 'vlan', [], s1_vlan_id).segment_member(
                SegmentMember('s1', cfg.leaf0['id']).ports(
                    [cfg.leaf0['portC'].name,
                     cfg.leaf0['portD'].name])).build())

        host[0]['ip'] = '192.168.2.118'
        host[1]['ip'] = '192.168.2.119'

        h0 = Host(host[0]).set_ip(vlan=10)
        h1 = Host(host[1]).set_ip(vlan=10)

        assert ('success' == h0.ping(host[1]['ip']))
Exemple #19
0
    def runTest(self):
        legacy_switch_same_vlan_different_subnet_setting()

        host0['ip'] = '192.168.80.118'
        host1['ip'] = '192.168.90.119'
        host2['ip'] = '192.168.100.103'
        host3['ip'] = '192.168.110.120'
        host4['ip'] = '192.168.120.83'
        host5['ip'] = '192.168.130.63'
        host6['ip'] = '192.168.140.115'
        host7['ip'] = '192.168.150.30'

        h0 = Host(host0).set_ip()
        h1 = Host(host1).set_ip()
        h2 = Host(host2).set_ip()
        h3 = Host(host3).set_ip()
        h4 = Host(host4).set_ip()
        h5 = Host(host5).set_ip()
        h6 = Host(host6).set_ip()
        h7 = Host(host7).set_ip()

        host_vlan_cfg1 = {
            'deviceId': cfg.sw46_188['id'],
            'vlanId': 80,
            'tagPorts': [cfg.sw46_188['front_port_B']],
            'untagPorts': [cfg.sw46_188['front_port_A']]
        }

        host_vlan_cfg2 = {
            'deviceId':
            cfg.sw46_126['id'],
            'vlanId':
            80,
            'tagPorts': [],
            'untagPorts':
            [cfg.sw46_126['front_port_A'], cfg.sw46_126['front_port_B']]
        }

        host_vlan_cfg3 = {
            'deviceId':
            cfg.sw46_185['id'],
            'vlanId':
            80,
            'tagPorts': [],
            'untagPorts':
            [cfg.sw46_185['front_port_A'], cfg.sw46_185['front_port_B']]
        }

        host_vlan_cfg4 = {
            'deviceId': cfg.sw46_223['id'],
            'vlanId': 80,
            'tagPorts': [],
            'untagPorts': [cfg.sw46_223['front_port_A']]
        }

        sr1 = (StaticRouting().add_rest_switch_vlan(
            cfg.sw67_205['id'], 80, "192.168.80.254/24", [
                "192.168.90.254/24", "192.168.100.254/24",
                "192.168.110.254/24", "192.168.120.254/24",
                "192.168.130.254/24", "192.168.140.254/24",
                "192.168.150.254/24"
            ]).add_host_vlan(host_vlan_cfg1).add_host_vlan(
                host_vlan_cfg2).add_host_vlan(host_vlan_cfg3).add_host_vlan(
                    host_vlan_cfg4).build())

        assert ('success' == h7.ping(host0['ip']))
        assert ('success' == h7.ping(host1['ip']))
        assert ('success' == h7.ping(host2['ip']))
        assert ('success' == h7.ping(host3['ip']))
        assert ('success' == h7.ping(host4['ip']))
        assert ('success' == h7.ping(host5['ip']))
        assert ('success' == h7.ping(host6['ip']))