Exemple #1
0
def test_1():
    #PRE-TEST Prep
    exec_shell('brctl delbr br400')
    exec_shell('ip link delete dev vtep500')
    #Create a VTEP 500
    prRed("Test Description: Create vtep500")
    assert vxlan_utils.create_vtep('vtep500', 500, '10.1.1.1', 'ipv4') == True
    exec_shell('ip link show dev vtep500')
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