def test_multi_ctr_mininet_ping():
    child = create_multicontroller_mininet_topology('MININETONE')
    if child.isalive() == True :
        print "Topology creation Success!!!"
    else:
        print "Topology creation Failed"
        mininet_test.mininet_test.close_topology(child)
        exit(1)

    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "TEST 3 :Controller Create Failed"
        mininet_test.close_topology(child)
        exit(1)
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
        print "controller state change failed"
        exit(1)

    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "TEST 3 :Controller Create Failed"
        mininet_test.close_topology(child)
        exit(1)
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond',"up")
    if retval != 0:
        print "controller state change failed"
        exit(1)

    retval = create_boundary('BOUNDARY', 'ControllerFirst', 'ControllerSecond')
    if retval != 0:
        print "Boundary  Create Failed"
        mininet_test.close_topology(child)
        exit(1)
    retval = validate_boundary('BOUNDARY', presence="yes", position=0)
    if retval != 0:
        print "Boundary  Validate  Failed after create"
        mininet_test.close_topology(child)
        exit(1)

    retval = vtn_vbr.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vtn_vbr.create_vbr('VtnOne', 'VbrOne', 'ControllerFirst')
    if retval != 0:
        print "VBR Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vtn_vbr.create_vbr('VtnOne', 'VbrTwo', 'ControllerSecond')
    if retval != 0:
        print "VBRTWO Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne')
    if retval != 0:
        print "VBRIFONE Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne', 'ControllerFirst', position=0)
    if retval != 0:
        print "VBRIFONE Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrOne', 'VbrIfTwo')
    if retval != 0:
        print "VBRIFONE Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrOne', 'VbrIfTwo', 'ControllerFirst', position=1)
    if retval != 0:
        print "VBRIFTWO Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_portmap('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne', vlan_tagged=0);
    if retval != 0:
        print "VBRIF1 Portmap Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne', 'ControllerFirst', presence="yes");
    if retval != 0:
        print "VBRIF1 Portmap Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrTwo', 'MultiCtrVbrIfThree')
    if retval != 0:
        print "VBRIFTHREE Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrTwo', 'MultiCtrVbrIfThree', 'ControllerSecond', position=0)
    if retval != 0:
        print "VBRIFTHREE Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrTwo', 'VbrIfFour')
    if retval != 0:
        print "VBRIFFOUR Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrTwo', 'VbrIfFour', 'ControllerSecond', position=0)
    if retval != 0:
        print "VBRIFFOUR Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_portmap('VtnOne', 'VbrTwo', 'MultiCtrVbrIfThree', vlan_tagged=0);
    if retval != 0:
        print "VBRIF3 Portmap Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne', 'VbrTwo', 'MultiCtrVbrIfThree', 'ControllerSecond', presence="yes");
    if retval != 0:
        print "VBRIF3 Portmap Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = create_vlink('VLINK', 'BOUNDARY', 'VtnOne')
    if retval != 0:
        print "Vlink create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = validate_vlink('VLINK', 'VtnOne', presence="yes", position=0)
    if retval != 0:
        print "Vlink validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = mininet_test.ping_mininet (child,'h2','h6')
    if retval != 0:
        print "MININET PING FAILED"

    mininet_test.close_topology(child)

    retval = delete_vlink('VLINK', 'VtnOne')
    if retval != 0:
        print "Vlink Delete Failed"
        exit(1)

    retval = validate_vlink('VLINK', 'VtnOne', presence="no")
    if retval != 0:
        print "After Delete validate vlink Failed"
        exit(1)

    retval = delete_boundary('BOUNDARY')
    if retval != 0:
        print "Delete boundary Failed"
        exit(1)

    retval = validate_boundary('BOUNDARY', presence="no")
    if retval != 0:
        print "After Delete validate boundary Failed"
        exit(1)

    retval = vbrif_portmap.delete_portmap('VtnOne', 'VbrTwo', 'MultiCtrVbrIfThree')
    if retval != 0:
        print "VBRIF3 portmap Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne', 'VbrTwo', 'MultiCtrVbrIfThree', 'ControllerSecond', presence="no");
    if retval != 0:
        print "After Delete VBRIF3 Portmap Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_portmap('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne')
    if retval != 0:
        print "VBRIF1 portmap Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne', 'ControllerFirst', presence="no");
    if retval != 0:
        print "After Delete VBRIF1 Portmap Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne')
    if retval != 0:
        print "VTN1->VBR1->VBRIF1 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne', 'ControllerFirst', presence="no")
    if retval != 0:
        print "After Delete VBRIFONE Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrOne', 'VbrIfTwo')
    if retval != 0:
        print "VTN1->VBR1->VBRIF2 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrOne', 'VbrIfTwo', 'ControllerFirst', presence="no")
    if retval != 0:
        print "After Delete VBRIFTWO Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrTwo', 'MultiCtrVbrIfThree')
    if retval != 0:
        print "VTN1->VBR2->VBRIF3 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrTwo', 'MultiCtrVbrIfThree', 'ControllerSecond', presence="no")
    if retval != 0:
        print "After Delete VBRIFTHREE Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrTwo', 'VbrIfFour')
    if retval != 0:
        print "VTN1->VBR2->VBRIF4 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrTwo', 'VbrIfFour', 'ControllerSecond', presence="no")
    if retval != 0:
        print "After Delete VBRIFFOUR Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vbr('VtnOne', 'VbrOne')
    if retval != 0:
        print "VBR/VTN Delete Failed"
        exit(1)

    retval = vtn_vbr.validate_vbr_at_controller('VtnOne', 'VbrOne', 'ControllerFirst', presence="no")
    if retval != 0:
        print "After Delete VBR1 Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vbr('VtnOne', 'VbrTwo')
    if retval != 0:
        print "VBR/VTN Delete Failed"
        exit(1)

    retval = vtn_vbr.validate_vbr_at_controller('VtnOne', 'VbrTwo', 'ControllerSecond', presence="no")
    if retval != 0:
        print "After Delete VBR2 Validate Failed"
        exit(1)

    retval = vtn_vbr.validate_vtn_at_controller('VtnOne', 'ControllerFirst', presence="no")
    if retval != 0:
        print "VTN Validate Failed"
        exit(1)

    retval = vtn_vbr.validate_vtn_at_controller('VtnOne', 'ControllerSecond', presence="no")
    if retval != 0:
        print "VTN Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vtn('VtnOne')
    if retval != 0:
        print "VTN Delete Failed in coordinator"
        exit(1)

    print "DELETE CONTROLLER"
    retval = controller.delete_controller_ex('ControllerFirst')
    if retval != 0:
        print "CONTROLLER1 delete failed"
        exit(1)

    retval = controller.delete_controller_ex('ControllerSecond')
    if retval != 0:
        print "CONTROLLER2 delete failed"
        exit(1)
    print "MININET PING MULTI CONTROLLER TEST SUCCESS"
Exemple #2
0
def test_vtn_mininet_ping_demo1():

    print """TEST 1 : One vtn and one VBridge with Two Interfaces one Portmap each
    send packets between two configured host(H1,H3)"""
    print "CREATE Controller"
    print "VTNONE->VBRONE->VBRIFONE->PORTMAP"
    print "VTNONE->VBRONE->VBRIFTWO->PORTMAP"

    child = create_mininet_topology('MININETONE', 'ControllerFirst', '2')
    if child.isalive() == True :
        print "Topology creation Success!!!"
    else:
        print "Topology creation Failed"
        close_topology(child)
        exit(1)

    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "TEST 1 :Controller Create Failed"
        close_topology(child)
        exit(1)
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
        print "controller state change failed"
        exit(1)

    retval = vtn_vbr.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        close_topology(child)
        exit(1)

    retval = vtn_vbr.create_vbr('VtnOne', 'VbrOne', 'ControllerFirst')
    if retval != 0:
        print "VBR Create Failed"
        close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrOne', 'VbrIfOne')
    if retval != 0:
        print "VBRIFONE Create Failed"
        close_topology(child)
        exit(1)
    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrOne', 'VbrIfOne', 'ControllerFirst', position=0)
    if retval != 0:
        print "VBRIFONE Validate Failed"
        close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrOne', 'VbrIfTwo')
    if retval != 0:
        print "VBRIFTWO Create Failed"
        close_topology(child)
        exit(1)
    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrOne', 'VbrIfTwo', 'ControllerFirst', position=1)
    if retval != 0:
        print "VBRIFTWO Validate Failed"
        close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_portmap('VtnOne', 'VbrOne', 'VbrIfOne', vlan_tagged=0);
    if retval != 0:
        print "VBRIF1 Portmap Create Failed"
        close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_portmap('VtnOne', 'VbrOne', 'VbrIfTwo', vlan_tagged=0);
    if retval != 0:
        print "VBRIF2 Portmap Create Failed"
        close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne', 'VbrOne', 'VbrIfOne', 'ControllerFirst', presence="yes");
    if retval != 0:
        print "VBRIF1 Portmap Validate Failed"
        close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne', 'VbrOne', 'VbrIfTwo', 'ControllerFirst', presence="yes");
    if retval != 0:
        print "VBRIF2 Portmap Validate Failed"
        close_topology(child)
        exit(1)

    retval = ping_mininet (child,'h1','h3')
    if retval != 0:
        print "MININET PING FAILED"

    close_topology(child)

    retval = vtn_vbr.validate_vbr_at_controller('VtnOne', 'VbrOne', 'ControllerFirst')
    if retval != 0:
        print "VBR Validate Failed"
        close_topology(child)
        exit(1)

    retval = vtn_vbr.validate_vtn_at_controller('VtnOne', 'ControllerFirst')
    if retval != 0:
        print "VTN Validate Failed"
        close_topology(child)
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrOne', 'VbrIfOne')
    if retval != 0:
        print "VTN1->VBR1->VBRIF1 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrOne', 'VbrIfOne', 'ControllerFirst', presence="no", position=0)
    if retval != 0:
        print "After Delete VBRIFONE Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrOne', 'VbrIfTwo')
    if retval != 0:
        print "VTN1->VBR1->VBRIF1 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne', 'VbrOne', 'VbrIfTwo', 'ControllerFirst', presence="no", position=1)
    if retval != 0:
        print "After Delete VBRIFTWO Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vbr('VtnOne', 'VbrOne')
    if retval != 0:
        print "VBR/VTN Delete Failed"
        exit(1)

    retval = vtn_vbr.validate_vbr_at_controller('VtnOne', 'VbrOne', 'ControllerFirst', presence="no")
    if retval != 0:
        print "After Delete VBR Validate Failed"
        exit(1)

    retval = vtn_vbr.validate_vtn_at_controller('VtnOne', 'ControllerFirst', presence="no")
    if retval != 0:
        print "VTN Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vtn('VtnOne')
    if retval != 0:
        print "VTN Delete Failed in coordinator"
        exit(1)

    print "DELETE CONTROLLER"
    retval = controller.delete_controller_ex('ControllerFirst')
    if retval != 0:
        print "CONTROLLER delete failed"
        exit(1)
    print "MININET PING DEMO 1 TEST SUCCESS"
def test_multi_ctr_mininet_ping():
    child = create_multicontroller_mininet_topology('MININETONE')
    if child.isalive() == True:
        print "Topology creation Success!!!"
    else:
        print "Topology creation Failed"
        mininet_test.mininet_test.close_topology(child)
        exit(1)

    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "TEST 3 :Controller Create Failed"
        mininet_test.close_topology(child)
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst', "up")
    if retval != 0:
        print "controller state change failed"
        exit(1)

    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "TEST 3 :Controller Create Failed"
        mininet_test.close_topology(child)
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "controller state change failed"
        exit(1)

    retval = create_boundary('BOUNDARY', 'ControllerFirst', 'ControllerSecond')
    if retval != 0:
        print "Boundary  Create Failed"
        mininet_test.close_topology(child)
        exit(1)
    retval = validate_boundary('BOUNDARY', presence="yes", position=0)
    if retval != 0:
        print "Boundary  Validate  Failed after create"
        mininet_test.close_topology(child)
        exit(1)

    retval = vtn_vbr.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vtn_vbr.create_vbr('VtnOne', 'VbrOne', 'ControllerFirst')
    if retval != 0:
        print "VBR Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vtn_vbr.create_vbr('VtnOne', 'VbrTwo', 'ControllerSecond')
    if retval != 0:
        print "VBRTWO Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne')
    if retval != 0:
        print "VBRIFONE Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne',
                                                        'VbrOne',
                                                        'MultiCtrVbrIfOne',
                                                        'ControllerFirst',
                                                        position=0)
    if retval != 0:
        print "VBRIFONE Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrOne', 'VbrIfTwo')
    if retval != 0:
        print "VBRIFONE Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne',
                                                        'VbrOne',
                                                        'VbrIfTwo',
                                                        'ControllerFirst',
                                                        position=1)
    if retval != 0:
        print "VBRIFTWO Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_portmap('VtnOne',
                                          'VbrOne',
                                          'MultiCtrVbrIfOne',
                                          vlan_tagged=0)
    if retval != 0:
        print "VBRIF1 Portmap Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller(
        'VtnOne',
        'VbrOne',
        'MultiCtrVbrIfOne',
        'ControllerFirst',
        presence="yes")
    if retval != 0:
        print "VBRIF1 Portmap Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrTwo',
                                        'MultiCtrVbrIfThree')
    if retval != 0:
        print "VBRIFTHREE Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne',
                                                        'VbrTwo',
                                                        'MultiCtrVbrIfThree',
                                                        'ControllerSecond',
                                                        position=0)
    if retval != 0:
        print "VBRIFTHREE Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_vbrif('VtnOne', 'VbrTwo', 'VbrIfFour')
    if retval != 0:
        print "VBRIFFOUR Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne',
                                                        'VbrTwo',
                                                        'VbrIfFour',
                                                        'ControllerSecond',
                                                        position=0)
    if retval != 0:
        print "VBRIFFOUR Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.create_portmap('VtnOne',
                                          'VbrTwo',
                                          'MultiCtrVbrIfThree',
                                          vlan_tagged=0)
    if retval != 0:
        print "VBRIF3 Portmap Create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller(
        'VtnOne',
        'VbrTwo',
        'MultiCtrVbrIfThree',
        'ControllerSecond',
        presence="yes")
    if retval != 0:
        print "VBRIF3 Portmap Validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = create_vlink('VLINK', 'BOUNDARY', 'VtnOne')
    if retval != 0:
        print "Vlink create Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = validate_vlink('VLINK', 'VtnOne', presence="yes", position=0)
    if retval != 0:
        print "Vlink validate Failed"
        mininet_test.close_topology(child)
        exit(1)

    retval = mininet_test.ping_mininet(child, 'h2', 'h6')
    if retval != 0:
        print "MININET PING FAILED"

    mininet_test.close_topology(child)

    retval = delete_vlink('VLINK', 'VtnOne')
    if retval != 0:
        print "Vlink Delete Failed"
        exit(1)

    retval = validate_vlink('VLINK', 'VtnOne', presence="no")
    if retval != 0:
        print "After Delete validate vlink Failed"
        exit(1)

    retval = delete_boundary('BOUNDARY')
    if retval != 0:
        print "Delete boundary Failed"
        exit(1)

    retval = validate_boundary('BOUNDARY', presence="no")
    if retval != 0:
        print "After Delete validate boundary Failed"
        exit(1)

    retval = vbrif_portmap.delete_portmap('VtnOne', 'VbrTwo',
                                          'MultiCtrVbrIfThree')
    if retval != 0:
        print "VBRIF3 portmap Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller(
        'VtnOne',
        'VbrTwo',
        'MultiCtrVbrIfThree',
        'ControllerSecond',
        presence="no")
    if retval != 0:
        print "After Delete VBRIF3 Portmap Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_portmap('VtnOne', 'VbrOne',
                                          'MultiCtrVbrIfOne')
    if retval != 0:
        print "VBRIF1 portmap Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_portmap_at_controller(
        'VtnOne',
        'VbrOne',
        'MultiCtrVbrIfOne',
        'ControllerFirst',
        presence="no")
    if retval != 0:
        print "After Delete VBRIF1 Portmap Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrOne', 'MultiCtrVbrIfOne')
    if retval != 0:
        print "VTN1->VBR1->VBRIF1 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne',
                                                        'VbrOne',
                                                        'MultiCtrVbrIfOne',
                                                        'ControllerFirst',
                                                        presence="no")
    if retval != 0:
        print "After Delete VBRIFONE Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrOne', 'VbrIfTwo')
    if retval != 0:
        print "VTN1->VBR1->VBRIF2 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne',
                                                        'VbrOne',
                                                        'VbrIfTwo',
                                                        'ControllerFirst',
                                                        presence="no")
    if retval != 0:
        print "After Delete VBRIFTWO Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrTwo',
                                        'MultiCtrVbrIfThree')
    if retval != 0:
        print "VTN1->VBR2->VBRIF3 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne',
                                                        'VbrTwo',
                                                        'MultiCtrVbrIfThree',
                                                        'ControllerSecond',
                                                        presence="no")
    if retval != 0:
        print "After Delete VBRIFTHREE Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne', 'VbrTwo', 'VbrIfFour')
    if retval != 0:
        print "VTN1->VBR2->VBRIF4 Delete Failed"
        exit(1)

    retval = vbrif_portmap.validate_vbrif_at_controller('VtnOne',
                                                        'VbrTwo',
                                                        'VbrIfFour',
                                                        'ControllerSecond',
                                                        presence="no")
    if retval != 0:
        print "After Delete VBRIFFOUR Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vbr('VtnOne', 'VbrOne')
    if retval != 0:
        print "VBR/VTN Delete Failed"
        exit(1)

    retval = vtn_vbr.validate_vbr_at_controller('VtnOne',
                                                'VbrOne',
                                                'ControllerFirst',
                                                presence="no")
    if retval != 0:
        print "After Delete VBR1 Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vbr('VtnOne', 'VbrTwo')
    if retval != 0:
        print "VBR/VTN Delete Failed"
        exit(1)

    retval = vtn_vbr.validate_vbr_at_controller('VtnOne',
                                                'VbrTwo',
                                                'ControllerSecond',
                                                presence="no")
    if retval != 0:
        print "After Delete VBR2 Validate Failed"
        exit(1)

    retval = vtn_vbr.validate_vtn_at_controller('VtnOne',
                                                'ControllerFirst',
                                                presence="no")
    if retval != 0:
        print "VTN Validate Failed"
        exit(1)

    retval = vtn_vbr.validate_vtn_at_controller('VtnOne',
                                                'ControllerSecond',
                                                presence="no")
    if retval != 0:
        print "VTN Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vtn('VtnOne')
    if retval != 0:
        print "VTN Delete Failed in coordinator"
        exit(1)

    print "DELETE CONTROLLER"
    retval = controller.delete_controller_ex('ControllerFirst')
    if retval != 0:
        print "CONTROLLER1 delete failed"
        exit(1)

    retval = controller.delete_controller_ex('ControllerSecond')
    if retval != 0:
        print "CONTROLLER2 delete failed"
        exit(1)
    print "MININET PING MULTI CONTROLLER TEST SUCCESS"
Exemple #4
0
def test_audit_vtn_vbr_multi_vbrif_portmap():
    print "CREATE Controller"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "TEST 6 :Controller Create Failed"
        exit(1)

    print "TEST 6 : VTenant with one VBridge Two VBRIF1/VBRIF2 and One PORTMAP in VBRIF1"
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)
    retval=vtn_vbr.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval=vtn_vbr.create_vbr('VtnOne','VbrOne','ControllerFirst')
    if retval != 0:
        print "VBR1 Create Failed"
        exit(1)

    retval=vbrif_portmap.create_vbrif('VtnOne','VbrOne','VbrIfOne')
    if retval != 0:
        print "VBRIF1 Create Failed"
        exit(1)

    retval=vbrif_portmap.create_vbrif('VtnOne','VbrOne','VbrIfTwo')
    if retval != 0:
        print "VBRIF2 Create Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst',position=0)
    if retval != 0:
        print "After Create VBRIF1 Validate Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfTwo','ControllerFirst',position=1)
    if retval != 0:
        print "After Create VBRIF2 Validate Failed"
        exit(1)

    retval=vbrif_portmap.create_portmap('VtnOne','VbrOne','VbrIfOne');
    if retval != 0:
        print "VBRIF1 Portmap Create Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst',presence="yes",position=0);
    if retval != 0:
        print "VBRIF1 Portmap Validate Failed"
        exit(1)

    print "****UPDATE Controller IP to invalid****"
    test_invalid_ipaddr=vtn_testconfig.ReadValues(CONTROLLERDATA,'ControllerFirst')['invalid_ipaddr']
    retval=controller.update_controller_ex('ControllerFirst',ipaddr=test_invalid_ipaddr)
    if retval != 0:
     print "controller invalid_ip update failed"
     exit(1)
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"down")
    if retval != 0:
      print "controller state change failed"
      exit(1)

    retval=vbrif_portmap.delete_portmap('VtnOne','VbrOne','VbrIfOne');
    if retval != 0:
        print "Portmap Delete Failed"
        exit(1)

    retval=vbrif_portmap.create_portmap('VtnOne','VbrOne','VbrIfTwo');
    if retval != 0:
        print "VBRIF2 Portmap Create Failed"
        exit(1)

    print "****UPDATE Controller IP to Valid****"
    test_controller_ipaddr=vtn_testconfig.ReadValues(CONTROLLERDATA,'ControllerFirst')['ipaddr']
    retval=controller.update_controller_ex('ControllerFirst',ipaddr=test_controller_ipaddr)
    if retval != 0:
     print "controller valid_ip update failed"
     exit(1)
   # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)

    retval=vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne','VbrOne','VbrIfTwo','ControllerFirst',presence="yes",position=0);
    if retval != 0:
        print "VBRIF2 Portmap Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vbr_at_controller('VtnOne','VbrOne','ControllerFirst',position=0)
    if retval != 0:
        print "After Create VBR1 Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vtn_at_controller('VtnOne','ControllerFirst')
    if retval != 0:
        print "VTN Validate Failed"
        exit(1)

    retval=vbrif_portmap.delete_portmap('VtnOne','VbrOne','VbrIfTwo');
    if retval != 0:
        print "Portmap Delete Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst',presence="no",position=0);
    if retval != 0:
        print "After Delete VBRIF1 Portmap Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne','VbrOne','VbrIfOne')
    if retval != 0:
        print "VBRIF1 Delete Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne','VbrOne','VbrIfTwo')
    if retval != 0:
        print "VBRIF2 Delete Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst',presence="no",position=0)
    if retval != 0:
        print "After Delete VBRIF1 Validate Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfTwo','ControllerFirst',presence="no",position=1)
    if retval != 0:
        print "After Delete VBRIF2 Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vbr('VtnOne','VbrOne')
    if retval != 0:
        print "VBR/VTN Delete Failed"
        exit(1)

    retval=vtn_vbr.validate_vbr_at_controller('VtnOne','VbrOne','ControllerFirst',presence="no")
    if retval != 0:
        print "After Delete VBR Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vtn_at_controller('VtnOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTN Validate Failed after VBR Deleted"
        exit(1)

    retval = vtn_vbr.delete_vtn('VtnOne')
    if retval != 0:
        print "VTN Delete Failed in coordinator"
        exit(1)

    print "DELETE CONTROLLER"
    retval=controller.delete_controller_ex('ControllerFirst')
    if retval != 0:
        print "CONTROLLER delete failed"
        exit(1)
    print "VTN1->VBR1->VBRIF1->PORTMAP(DELETE) AND VTN1->VBR1->VBRIF2->PORTMAP(CREATE) AUDIT TEST SUCCESS"
Exemple #5
0
def test_audit_vtn_vbr_vbrif_portmap():

    print "CREATE Controller"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "TEST 4 :Controller Create Failed"
        exit(1)

    print "TEST 4 : Test Audit with VTenant one VBridge one VBRIF and One PORTMAP"
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)
    retval=vtn_vbr.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval=vtn_vbr.create_vbr('VtnOne','VbrOne','ControllerFirst')
    if retval != 0:
        print "VBR Create Failed"
        exit(1)

    retval=vbrif_portmap.create_vbrif('VtnOne','VbrOne','VbrIfOne')
    if retval != 0:
        print "VBRIF Create Failed"
        exit(1)
    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst')
    if retval != 0:
        print "After Create VBRIF Validate Failed"
        exit(1)

    print "****UPDATE Controller IP to invalid****"
    test_invalid_ipaddr=vtn_testconfig.ReadValues(CONTROLLERDATA,'ControllerFirst')['invalid_ipaddr']
    retval=controller.update_controller_ex('ControllerFirst',ipaddr=test_invalid_ipaddr)
    if retval != 0:
     print "controller invalid_ip update failed"
     exit(1)
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"down")
    if retval != 0:
      print "controller state change failed"
      exit(1)

    retval=vbrif_portmap.create_portmap('VtnOne','VbrOne','VbrIfOne');
    if retval != 0:
        print "Portmap Create Failed"
        exit(1)

    print "****UPDATE Controller IP to Valid****"
    test_controller_ipaddr=vtn_testconfig.ReadValues(CONTROLLERDATA,'ControllerFirst')['ipaddr']
    retval=controller.update_controller_ex('ControllerFirst',ipaddr=test_controller_ipaddr)
    if retval != 0:
     print "controller valid_ip update failed"
     exit(1)
   # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)

    retval=vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst',presence="yes");
    if retval != 0:
        print "Portmap Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vbr_at_controller('VtnOne','VbrOne','ControllerFirst')
    if retval != 0:
        print "After Create VBR Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vtn_at_controller('VtnOne','ControllerFirst')
    if retval != 0:
        print "VTN Validate Failed"
        exit(1)

    retval=vbrif_portmap.delete_portmap('VtnOne','VbrOne','VbrIfOne');
    if retval != 0:
        print "Portmap Delete Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_portmap_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst',presence="no");
    if retval != 0:
        print "After Delete Portmap Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne','VbrOne','VbrIfOne')
    if retval != 0:
        print "VBRIF Delete Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst',presence="no",position=0)
    if retval != 0:
        print "After Delete VBRIF Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vbr('VtnOne','VbrOne')
    if retval != 0:
        print "VBR/VTN Delete Failed"
        exit(1)

    retval=vtn_vbr.validate_vbr_at_controller('VtnOne','VbrOne','ControllerFirst',presence="no")
    if retval != 0:
        print "After Delete VBR Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vtn_at_controller('VtnOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTN Validate Failed after VBR Deleted"
        exit(1)

    retval = vtn_vbr.delete_vtn('VtnOne')
    if retval != 0:
        print "VTN Delete Failed in coordinator"
        exit(1)

    print "DELETE CONTROLLER"
    retval=controller.delete_controller_ex('ControllerFirst')
    if retval != 0:
        print "CONTROLLER delete failed"
        exit(1)
    print "VTN->VBR->VBRIF->PORTMAP AUDIT TEST SUCCESS"
Exemple #6
0
def test_audit_vtn_multi_vbr_vbrif():
    print "CREATE Controller"
    print "VTNONE->VBRONE->VBRIFONE/VBRIFTHREE"
    print "VTNONE->VBRTWO->VBRIFTWO/VBRIFFOUR"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "TEST 3 :Controller Create Failed"
        exit(1)

    print "TEST 3 : Audit One vtn and Two VBridges with Two Interfaces each"
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)
    retval=vtn_vbr.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval=vtn_vbr.create_vbr('VtnOne','VbrOne','ControllerFirst')
    if retval != 0:
        print "VBR1 Create Failed"
        exit(1)

    retval=vtn_vbr.create_vbr('VtnOne','VbrTwo','ControllerFirst')
    if retval != 0:
        print "VBR2 Create Failed"
        exit(1)

    retval=vbrif_portmap.create_vbrif('VtnOne','VbrOne','VbrIfOne')
    if retval != 0:
        print "VBRIF1 Create Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst',position=0)
    if retval != 0:
        print "VBRIF1 Validate Failed"
        exit(1)

    retval=vbrif_portmap.create_vbrif('VtnOne','VbrTwo','VbrIfOne')
    if retval != 0:
        print "VBR2->VBRIF1 Create Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrTwo','VbrIfOne','ControllerFirst',position=0)
    if retval != 0:
        print "VBR2->VBRIF2 Validate Failed"
        exit(1)

    print "****UPDATE Controller IP to invalid****"
    test_invalid_ipaddr=vtn_testconfig.ReadValues(CONTROLLERDATA,'ControllerFirst')['invalid_ipaddr']
    retval=controller.update_controller_ex('ControllerFirst',ipaddr=test_invalid_ipaddr)
    if retval != 0:
     print "controller invalid_ip update failed"
     exit(1)
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"down")
    if retval != 0:
      print "controller state change failed"
      exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne','VbrOne','VbrIfOne')
    if retval != 0:
        print "VBR1->VBRIF1 Delete Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne','VbrTwo','VbrIfOne')
    if retval != 0:
        print "VBR2->VBRIF1 Delete Failed"
        exit(1)

    retval=vbrif_portmap.create_vbrif('VtnOne','VbrOne','VbrIfThree')
    if retval != 0:
        print "VBRIF3 Create Failed"
        exit(1)

    retval=vbrif_portmap.create_vbrif('VtnOne','VbrTwo','VbrIfTwo')
    if retval != 0:
        print "VBR2->VBRIF2 Create Failed"
        exit(1)

    print "****UPDATE Controller IP to Valid****"
    test_controller_ipaddr=vtn_testconfig.ReadValues(CONTROLLERDATA,'ControllerFirst')['ipaddr']
    retval=controller.update_controller_ex('ControllerFirst',ipaddr=test_controller_ipaddr)
    if retval != 0:
     print "controller valid_ip update failed"
     exit(1)
   # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfThree','ControllerFirst',position=0)
    if retval != 0:
        print "VBRIF3 Validate Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrTwo','VbrIfTwo','ControllerFirst',position=0)
    if retval != 0:
        print "VBR2->VBRIF2 Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vbr_at_controller('VtnOne','VbrOne','ControllerFirst',position=0)
    if retval != 0:
        print "VBRONE Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vbr_at_controller('VtnOne','VbrTwo','ControllerFirst',position=1)
    if retval != 0:
        print "VBRTWO Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vtn_at_controller('VtnOne','ControllerFirst')
    if retval != 0:
        print "VTN Validate Failed"
        exit(1)


    retval = vbrif_portmap.delete_vbrif('VtnOne','VbrOne','VbrIfThree')
    if retval != 0:
        print "VBR1->VBRIF3 Delete Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfOne','ControllerFirst',presence="no",position=0)
    if retval != 0:
        print "VBR1->VBRIF1 Validate Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrOne','VbrIfThree','ControllerFirst',presence="no",position=0)
    if retval != 0:
        print "VBR1->VBRIF3 Validate Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrTwo','VbrIfOne','ControllerFirst',presence="no",position=0)
    if retval != 0:
        print "VBR2->VBRIF1 Validate Failed"
        exit(1)

    retval = vbrif_portmap.delete_vbrif('VtnOne','VbrTwo','VbrIfTwo')
    if retval != 0:
        print "VBR2->VBRIF2 Delete Failed"
        exit(1)

    retval=vbrif_portmap.validate_vbrif_at_controller('VtnOne','VbrTwo','VbrIfTwo','ControllerFirst',presence="no",position=1)
    if retval != 0:
        print "VBR2->VBRIF2 Validate Failed"
        exit(1)
    retval = vtn_vbr.delete_vbr('VtnOne','VbrOne')
    if retval != 0:
        print "VBR1/VTN Delete Failed"
        exit(1)

    retval = vtn_vbr.delete_vbr('VtnOne','VbrTwo')
    if retval != 0:
        print "VBR2/VTN Delete Failed"
        exit(1)

    retval=vtn_vbr.validate_vbr_at_controller('VtnOne','VbrOne','ControllerFirst',presence="no",position=0)
    if retval != 0:
        print "VBR1/VTN Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vbr_at_controller('VtnOne','VbrTwo','ControllerFirst',presence="no",position=1)
    if retval != 0:
        print "VBR2/VTN Validate Failed"
        exit(1)

    retval=vtn_vbr.validate_vtn_at_controller('VtnOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTN Validate Failed"
        exit(1)

    retval = vtn_vbr.delete_vtn('VtnOne')
    if retval != 0:
        print "VTN Delete Failed in coordinator"
        exit(1)

    print "DELETE CONTROLLER"
    retval=controller.delete_controller_ex('ControllerFirst')
    if retval != 0:
        print "CONTROLLER delete failed"
        exit(1)
    print "VTN1->VBR1->VBRIF1/VBRIF3 AND VTN1->VBR2->VBRIF1/VBRIF2 AUDIT TEST SUCCESS"