def _parse_args(args):
    if args.command == 'create':
        if args.subcommand == 'bridge':
            return vxlan_utils.create_bridge_interface(args.name, [])
        elif args.subcommand == 'vtep':
            return vxlan_utils.create_vtep(args.name, args.vni, args.ip,
                                           args.family)
        elif args.subcommand == 'vlanSubIntf':
            return vxlan_utils.create_vlan_subintf(args.parent, args.vlan_id)
        return

    elif args.command == 'delete':
        if args.subcommand == 'bridge':
            return vxlan_utils.delete_bridge_interface(args.name)
        elif args.subcommand == 'vtep':
            return vxlan_utils.delete_vtep(args.name)
        elif args.subcommand == 'vlanSubIntf':
            return vxlan_utils.delete_vlan_subintf(args.parent, args.vlan_id)
        return

    elif args.command == 'add':
        if args.subcommand == 'tagged':
            return vxlan_utils.add_tagged_access_ports_to_bridge_interface(
                args.bridge_name, [args.tagged_member_name])
        elif args.subcommand == 'untagged':
            return vxlan_utils.add_untagged_access_ports_to_bridge_interface(
                args.bridge_name, [args.untagged_member_name])
        elif args.subcommand == 'vtep':
            return vxlan_utils.add_vteps_to_bridge_interface(
                args.bridge_name, [args.vtep_name])
        elif args.subcommand == 'remote-endpoint':
            re = vxlan_utils.RemoteEndpoint(args.ip, args.family,
                                            args.flooding_enabled)
            return vxlan_utils.add_remote_endpoint(args.vtep_name, [re])
        return

    elif args.command == 'remove':
        if args.subcommand == 'tagged':
            return vxlan_utils.remove_tagged_access_ports_to_bridge_interface(
                args.bridge_name, [args.tagged_member_name])
        elif args.subcommand == 'untagged':
            return vxlan_utils.remove_untagged_access_ports_to_bridge_interface(
                args.bridge_name, [args.untagged_member_name])
        elif args.subcommand == 'vtep':
            return vxlan_utils.remove_vteps_from_bridge_interface(
                args.bridge_name, [args.vtep_name])
        elif args.subcommand == 'remote-endpoint':
            re = vxlan_utils.RemoteEndpoint(args.ip, args.family,
                                            args.flooding_enabled)
            return vxlan_utils.remove_remote_endpoint(args.vtep_name, [re])
        return
Exemple #2
0
def test_5():
    #Remove vtep500 remote endpoint(1.1.1.1)
    prRed("Test Description: Remove remote endpoint(1.1.1.1) from vtep500")
    re = vxlan_utils.RemoteEndpoint('1.1.1.1', 'ipv4', 1, "00:00:00:00:00:11")
    remote_endpoints = [re]
    assert vxlan_utils.remove_remote_endpoint('vtep500', remote_endpoints) == True
    exec_shell('bridge fdb | grep vtep500')
Exemple #3
0
def test_4():
    #Remove vtep500 remote endpoint(1.1.1.2) (1.1.1.2 doesn't exist)
    prRed("Test Description: Remove remote endpoint(1.1.1.2) from vtep500")
    re = vxlan_utils.RemoteEndpoint('1.1.1.2', 'ipv4', 1, "00:00:00:00:00:22")
    remote_endpoints = [re]
    assert vxlan_utils.remove_remote_endpoint('vtep500', remote_endpoints) == False
    exec_shell('bridge fdb | grep vtep500')
Exemple #4
0
def test_2():
    #Add a remote endpoint(1.1.1.1) to vtep500
    prRed("Test Description: Add remote endpoint(1.1.1.1) to vtep500")
    re = vxlan_utils.RemoteEndpoint('1.1.1.1', 'ipv4', 1, "00:00:00:00:00:11")
    remote_endpoints = [re]
    assert vxlan_utils.add_remote_endpoint('vtep500', remote_endpoints) == True
    exec_shell('bridge fdb | grep vtep500')
Exemple #5
0
def test_3():
    #PRE-TEST Prep
    exec_shell('ip link delete dev vtep600')
    #Create a VTEP 600 with remote endpoints
    prRed("Test Description: Create vtep600 with Remote endpoint(1.1.1.2)")
    re = vxlan_utils.RemoteEndpoint('1.1.1.2', 'ipv4', 1, "00:00:00:00:00:22")
    remote_endpoints = [re]
    assert vxlan_utils.create_vtep_with_remote_endpoints('vtep600', 600, '10.1.1.2', 'ipv4', remote_endpoints) == True
    exec_shell('ip link show dev vtep600')