Beispiel #1
0
def test_audit_vtn_vterm_vtermif_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 VTerminal one VTERMIF 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_vterm.create_vtn('VtnOne')
    if retval != 0:
      print "VTN Create Failed"
      exit(1)

    retval=vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
      print "VTERM Create 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=vtermif_portmap.create_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
      print "VTERMIF Create Failed"
      exit(1)

    retval=vtermif_portmap.create_portmap('VtnOne','VTermOne','VTermIfOne');
    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=vtermif_portmap.validate_vtermif_portmap_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence="yes");
    if retval != 0:
      print "Portmap Validate Failed"
      exit(1)

    retval=vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
      print "After Create VTERM Validate Failed"
      exit(1)

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

    retval=vtermif_portmap.delete_portmap('VtnOne','VTermOne','VTermIfOne');
    if retval != 0:
      print "Portmap Delete Failed"
      exit(1)

    retval = vtermif_portmap.delete_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
      print "VTERMIF Delete Failed"
      exit(1)

    retval=vtermif_portmap.validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence="no",position=0)
    if retval != 0:
      print "After Delete VTERMIF Validate Failed"
      exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
      print "VTERM/VTN Delete Failed"
      exit(1)

    retval=vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
      print "After Delete VTERM Validate Failed"
      exit(1)

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

    retval = vtn_vterm.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->VTERM->VTERMIF->PORTMAP AUDIT TEST SUCCESS"
Beispiel #2
0
def test_vtn_vterm_audit_1():

    print "****CREATE Controller with valid IP****"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller Create Failed"
        exit(1)

    print """TEST 1 : create VTN and VTERM when controller is up
             change the controller status to down delete VTN and VTERM
             trigger Audit"""
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)
    print "****Create VTN****"
    retval = vtn_vterm.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    print "****Create VTERM****"
    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)


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


    retval =  vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM 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)

    print "****Delete VTERM****"
    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    print "****Delete VTN****"
    retval = vtn_vterm.delete_vtn('VtnOne')
    if retval != 0:
        print "VTN Delete Failed in coordinator"
        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 =  vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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


    print "DELETE CONTROLLER"
    retval = controller.delete_controller_ex('ControllerFirst')
    if retval != 0:
        print "CONTROLLER delete failed"
        exit(1)
    print "VTN->VTERM AUDIT TEST SUCCESS"
def test_audit_vtn_vterm_vtermif_portmap_multi_controller():

    print "CREATE Controller"
    retval = controller.add_controller_ex("ControllerFirst")
    if retval != 0:
        print "TEST 4 :Controller1 Create Failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = controller.add_controller_ex("ControllerSecond")
    if retval != 0:
        print "TEST 4 :Controller2 Create Failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerSecond", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    print "TEST 4 : VTenant with one VTerminal one VTERMIF and One PORTMAP with multi-controller"

    retval = vtn_vterm.create_vtn("VtnOne")
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm("VtnOne", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "VTERM1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm("VtnOne", "VTermThree", "ControllerSecond")
    if retval != 0:
        print "VTERM3 Create Failed"
        exit(1)

    retval = vtermif_portmap.create_vtermif("VtnOne", "VTermOne", "VTermIfOne")
    if retval != 0:
        print "VTERMIF1 Create Failed"
        exit(1)

    retval = vtermif_portmap.create_vtermif("VtnOne", "VTermThree", "VTermIfTwo")
    if retval != 0:
        print "VTERMIF2 Create Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_at_controller("VtnOne", "VTermOne", "VTermIfOne", "ControllerFirst")
    if retval != 0:
        print "After Create VTERMIF1 Validate Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_at_controller("VtnOne", "VTermThree", "VTermIfTwo", "ControllerSecond")
    if retval != 0:
        print "After Create VTERMIF2 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 "controller1 invalid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_invalid_ipaddr = vtn_testconfig.ReadValues(CONTROLLERDATA, "ControllerSecond")["invalid_ipaddr"]
    retval = controller.update_controller_ex("ControllerSecond", ipaddr=test_invalid_ipaddr)
    if retval != 0:
        print "controller2 invalid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerSecond", "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = vtermif_portmap.create_portmap("VtnOne", "VTermOne", "VTermIfOne")
    if retval != 0:
        print "Portmap1 Create Failed"
        exit(1)

    retval = vtermif_portmap.create_portmap("VtnOne", "VTermThree", "VTermIfTwo")
    if retval != 0:
        print "Portmap2 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 "controller1 valid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_controller_ipaddr = vtn_testconfig.ReadValues(CONTROLLERDATA, "ControllerSecond")["ipaddr"]
    retval = controller.update_controller_ex("ControllerSecond", ipaddr=test_controller_ipaddr)
    if retval != 0:
        print "controller2 valid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerSecond", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_portmap_at_controller(
        "VtnOne", "VTermOne", "VTermIfOne", "ControllerFirst", presence="yes"
    )
    if retval != 0:
        print "Portmap1 Validate Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_portmap_at_controller(
        "VtnOne", "VTermThree", "VTermIfTwo", "ControllerSecond", presence="yes"
    )
    if retval != 0:
        print "Portmap2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "After Create VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermThree", "ControllerSecond")
    if retval != 0:
        print "After Create VTERM3 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller("VtnOne", "ControllerSecond")
    if retval != 0:
        print "VTN Validate Failed at controller2"
        exit(1)

    retval = vtermif_portmap.delete_portmap("VtnOne", "VTermOne", "VTermIfOne")
    if retval != 0:
        print "Portmap1 Delete Failed"
        exit(1)

    retval = vtermif_portmap.delete_portmap("VtnOne", "VTermThree", "VTermIfTwo")
    if retval != 0:
        print "Portmap2 Delete Failed"
        exit(1)

    #    retval=vtermif_portmap.validate_vtermif_portmap_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence="no");
    #    if retval != 0:
    #        print "After Delete Portmap1 Validate Failed"
    #        exit(1)

    #    retval=vtermif_portmap.validate_vtermif_portmap_at_controller('VtnOne','VTermThree','VTermIfTwo','ControllerSecond',presence="no");
    #    if retval != 0:
    #        print "After Delete Portmap2 Validate Failed"
    #        exit(1)

    retval = vtermif_portmap.delete_vtermif("VtnOne", "VTermOne", "VTermIfOne")
    if retval != 0:
        print "VTERMIF1 Delete Failed"
        exit(1)

    retval = vtermif_portmap.delete_vtermif("VtnOne", "VTermThree", "VTermIfTwo")
    if retval != 0:
        print "VTERMIF2 Delete Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_at_controller(
        "VtnOne", "VTermOne", "VTermIfOne", "ControllerFirst", presence="no", position=0
    )
    if retval != 0:
        print "After Delete VTERMIF1 Validate Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_at_controller(
        "VtnOne", "VTermThree", "VTermIfTwo", "ControllerSecond", presence="no", position=0
    )
    if retval != 0:
        print "After Delete VTERMIF2 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm("VtnOne", "VTermOne")
    if retval != 0:
        print "VTERM1/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm("VtnOne", "VTermThree")
    if retval != 0:
        print "VTERM3/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermOne", "ControllerFirst", presence="no")
    if retval != 0:
        print "After Delete VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermThree", "ControllerSecond", presence="no")
    if retval != 0:
        print "After Delete VTERM2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnOne", "ControllerFirst", presence="no")
    if retval != 0:
        print "VTN Validate Failed after VTERM1 Deleted at controller1"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnOne", "ControllerSecond", presence="no")
    if retval != 0:
        print "VTN Validate Failed after VTERM3 Deleted at controller2"
        exit(1)

    retval = vtn_vterm.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 "VTN->VTERM->VTERMIF->PORTMAP MULTI-CONTROLER TEST SUCCESS"
Beispiel #4
0
def test_audit_vtn_multi_vterm_vtermif():
    print "CREATE Controller"
    print "VTNONE->VTERMONE->VTERMIFONE/VTERMIFTHREE"
    print "VTNONE->VTERMTWO->VTERMIFTWO/VTERMIFFOUR"
    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 VTerminals 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_vterm.create_vtn('VtnOne')
    if retval != 0:
      print "VTN Create Failed"
      exit(1)

    retval=vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
      print "VTERM1 Create Failed"
      exit(1)

    retval=vtn_vterm.create_vterm('VtnOne','VTermTwo','ControllerFirst')
    if retval != 0:
      print "VTERM2 Create Failed"
      exit(1)

    retval=vtermif_portmap.create_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
      print "VTERMIF1 Create Failed"
      exit(1)

    retval=vtermif_portmap.validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',position=0)
    if retval != 0:
      print "VTERMIF1 Validate Failed"
      exit(1)

    retval=vtermif_portmap.create_vtermif('VtnOne','VTermTwo','VTermIfOne')
    if retval != 0:
      print "VTERM2->VTERMIF1 Create Failed"
      exit(1)

    retval=vtermif_portmap.validate_vtermif_at_controller('VtnOne','VTermTwo','VTermIfOne','ControllerFirst',position=0)
    if retval != 0:
      print "VTERM2->VTERMIF2 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 = vtermif_portmap.delete_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
      print "VTERM1->VTERMIF1 Delete Failed"
      exit(1)

    retval = vtermif_portmap.delete_vtermif('VtnOne','VTermTwo','VTermIfOne')
    if retval != 0:
      print "VTERM2->VTERMIF1 Delete Failed"
      exit(1)

    retval=vtermif_portmap.create_vtermif('VtnOne','VTermOne','VTermIfThree')
    if retval != 0:
      print "VTERMIF3 Create Failed"
      exit(1)

    retval=vtermif_portmap.create_vtermif('VtnOne','VTermTwo','VTermIfTwo')
    if retval != 0:
      print "VTERM2->VTERMIF2 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=vtermif_portmap.validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfThree','ControllerFirst',position=0)
    if retval != 0:
      print "VTERMIF3 Validate Failed"
      exit(1)

    retval=vtermif_portmap.validate_vtermif_at_controller('VtnOne','VTermTwo','VTermIfTwo','ControllerFirst',position=0)
    if retval != 0:
      print "VTERM2->VTERMIF2 Validate Failed"
      exit(1)

    retval=vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',position=0)
    if retval != 0:
      print "VTERMONE Validate Failed"
      exit(1)

    retval=vtn_vterm.validate_vterm_at_controller('VtnOne','VTermTwo','ControllerFirst',position=0)
    if retval != 0:
      print "VTERMTWO Validate Failed"
      exit(1)

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


    retval = vtermif_portmap.delete_vtermif('VtnOne','VTermOne','VTermIfThree')
    if retval != 0:
      print "VTERM1->VTERMIF3 Delete Failed"
      exit(1)

    retval=vtermif_portmap.validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence="no",position=0)
    if retval != 0:
      print "VTERM1->VTERMIF1 Validate Failed"
      exit(1)

    retval=vtermif_portmap.validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfThree','ControllerFirst',presence="no",position=0)
    if retval != 0:
      print "VTERM1->VTERMIF3 Validate Failed"
      exit(1)

    retval=vtermif_portmap.validate_vtermif_at_controller('VtnOne','VTermTwo','VTermIfOne','ControllerFirst',presence="no",position=0)
    if retval != 0:
      print "VTERM2->VTERMIF1 Validate Failed"
      exit(1)

    retval = vtermif_portmap.delete_vtermif('VtnOne','VTermTwo','VTermIfTwo')
    if retval != 0:
      print "VTERM2->VTERMIF2 Delete Failed"
      exit(1)

    retval=vtermif_portmap.validate_vtermif_at_controller('VtnOne','VTermTwo','VTermIfTwo','ControllerFirst',presence="no",position=0)
    if retval != 0:
      print "VTERM2->VTERMIF2 Validate Failed"
      exit(1)
    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
      print "VTERM1/VTN Delete Failed"
      exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermTwo')
    if retval != 0:
      print "VTERM2/VTN Delete Failed"
      exit(1)

    retval=vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence="no",position=0)
    if retval != 0:
      print "VTERM1/VTN Validate Failed"
      exit(1)

    retval=vtn_vterm.validate_vterm_at_controller('VtnOne','VTermTwo','ControllerFirst',presence="no",position=0)
    if retval != 0:
      print "VTERM2/VTN Validate Failed"
      exit(1)

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

    retval = vtn_vterm.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->VTERM1->VTERMIF1/VTERMIF3 AND VTN1->VTERM2->VTERMIF1/VTERMIF2 AUDIT TEST SUCCESS"
Beispiel #5
0
def test_multi_vtn_vterm_vtermif_portmap():
    print "CREATE Controller"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "TEST 10 :Controller Create Failed"
        exit(1)

    print "TEST 10 : Two VTenant with Two VTerminal Two VTERMIF and One PORTMAP each"
  # Delay for AUDIT
    time.sleep(15)
    retval = vtn_vterm.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vtn('VtnTwo')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo','VTermTwo','ControllerFirst')
    if retval != 0:
        print "VTERM2 Create Failed"
        exit(1)

    retval = create_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
        print "VTERMIF1 Create Failed"
        exit(1)

    retval = create_vtermif('VtnTwo','VTermTwo','VTermIfTwo')
    if retval != 0:
        print "VTERMIF2 Create Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',position = 0)
    if retval != 0:
        print "After Create VTERMIF1 Validate Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnTwo','VTermTwo','VTermIfTwo','ControllerFirst',position = 0)
    if retval != 0:
        print "After Create VTERMIF2 Validate Failed"
        exit(1)

    retval = create_portmap('VtnOne','VTermOne','VTermIfOne');
    if retval != 0:
        print "VTERMIF1 Portmap Create Failed"
        exit(1)

    retval = create_portmap('VtnTwo','VTermTwo','VTermIfTwo');
    if retval != 0:
        print "VTERMIF2 Portmap Create Failed"
        exit(1)

    retval = validate_vtermif_portmap_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence = "yes",position = 0);
    if retval != 0:
        print "VTERMIF1 Portmap Validate Failed"
        exit(1)

    retval = validate_vtermif_portmap_at_controller('VtnTwo','VTermTwo','VTermIfTwo','ControllerFirst',presence = "yes",position = 0);
    if retval != 0:
        print "VTERMIF2 Portmap Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',position = 0)
    if retval != 0:
        print "After Create VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermTwo','ControllerFirst',position = 0)
    if retval != 0:
        print "After Create VTERM1 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo','ControllerFirst',position = 0)
    if retval != 0:
        print "VTN2 Validate Failed"
        exit(1)

    retval = delete_portmap('VtnOne','VTermOne','VTermIfOne');
    if retval != 0:
        print "Portmap Delete Failed"
        exit(1)

    retval = delete_portmap('VtnTwo','VTermTwo','VTermIfTwo');
    if retval != 0:
        print "VTermIfTwo Portmap Delete Failed"
        exit(1)

    retval = delete_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
        print "VTERMIF1 Delete Failed"
        exit(1)

    retval = delete_vtermif('VtnTwo','VTermTwo','VTermIfTwo')
    if retval != 0:
        print "VTERMIF2 Delete Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "After Delete VTERMIF1 Validate Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnTwo','VTermTwo','VTermIfTwo','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "After Delete VTERMIF2 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo','VTermTwo')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "After Delete VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermTwo','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "After Delete VTERM2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "VTN1 Validate Failed after VTERM Deleted"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "VTN2 Validate Failed after VTERM Deleted"
        exit(1)

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

    retval = vtn_vterm.delete_vtn('VtnTwo')
    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->VTERM1->VTERMIF1->PORTMAP AND VTN2->VTERM2->VTERMIF2->PORTMAP TEST SUCCESS"
def test_vtn_vterm_multi_controller():
    print "TEST 1 : 1 Tenants with 1 VTerminal each on different controllers"
    print "CONTROLLER1->VTNONE->VTERMONE"
    print "CONTROLLER2->VTNONE->VTERMTWO"
    print "CREATE ControllerFirst"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerFirst', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    print "CREATE ControllerSecond"
    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "Controller Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

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

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermOne', 'ControllerFirst')
    if retval != 0:
        print "VTERM Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermThree', 'ControllerSecond')
    if retval != 0:
        print "VTERM Create Failed"
        exit(1)

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

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

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermOne',
                                                    'ControllerFirst')
    if retval != 0:
        print "VTERMOne Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermThree',
                                                    'ControllerSecond')
    if retval != 0:
        print "VTERMTwo Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermThree')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermThree',
                                                    'ControllerSecond',
                                                    presence="no")
    if retval != 0:
        print "VtnVTERMTwo Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermOne',
                                                    'ControllerFirst')
    if retval != 0:
        print "VtnVTERM Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermOne',
                                                    'ControllerFirst',
                                                    presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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

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

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

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

    print "MULTI CONTROLLER VTN->VTERM TEST SUCCESS"
def test_multi_vtn_with_vterm_multi_controller():
    print "TEST 3 : 2 Tenants with one VTerminal each"
    print "CONTROLLER1->VTNONE->VTERMONE"
    print "CONTROLLER1->VTNTWO->VTERMONE"
    print "CONTROLLER2->VTNONE->VTERMONE"
    print "CONTROLLER2->VTNTWO->VTERMONE"
    print "CREATE Controller"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller1 Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "Controller state check failed"
      exit(1)

    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "Controller2 Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerSecond',"up")
    if retval != 0:
      print "Controller state check failed"
      exit(1)

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

    retval = vtn_vterm.create_vtn('VtnTwo')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM2 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermThree','ControllerSecond')
    if retval != 0:
        print "VTERM3 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo','VTermThree','ControllerSecond')
    if retval != 0:
        print "VTERM4 Create Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne','ControllerFirst',position=0)
    if retval != 0:
        print "VTN1/CONTROLLER1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo','ControllerFirst',position=0)
    if retval != 0:
        print "VTN2/CONTROLLER2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne','ControllerSecond',position=0)
    if retval != 0:
        print "VTN1/CONTROLLER2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo','ControllerSecond',position=0)
    if retval != 0:
        print "VTN2/CONTROLLER2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM1/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM1/VTN2 Validate Failed "
        exit(1)

    retval=vtn_vterm.validate_vterm_at_controller('VtnOne','VTermThree','ControllerSecond')
    if retval != 0:
        print "VTERM2/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermThree','ControllerSecond')
    if retval != 0:
        print "VTERM2/VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vterm('VtnTwo','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval=vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM2 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vterm('VtnOne','VTermThree')
    if retval != 0:
        print "VTERM2/VTN1 Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermThree','ControllerSecond',presence="no")
    if retval != 0:
        print "VTERM2/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo','VTermThree')
    if retval != 0:
        print "VTERM2/VTN2 Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermThree','ControllerSecond',presence="no")
    if retval != 0:
        print "VTERM2/VTN2 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vtn('VtnTwo')
    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 "MULTI VTN->VTERM MULTI-CONTROLLER TEST SUCCESS"
Beispiel #8
0
def test_multi_vtn_vterm_vtermif():

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

    print "TEST 4 : Two Vtn and Two Vterminal one Interfaces each "
  # Delay for AUDIT
    time.sleep(15)
    retval = vtn_vterm.create_vtn('VtnOne')
    if retval != 0:
        print "VTN1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vtn('VtnTwo')
    if retval != 0:
        print "VTN2 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTN1->VTERM1 Create Failed"
        exit(1)

    retval = create_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
        print "VTN1->VTERM1->VTERMIF1 Create Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst')
    if retval != 0:
        print "VTN1->VTERM1->VTERMIF1 Validate Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo','VTermTwo','ControllerFirst')
    if retval != 0:
        print "VTN1->VTERM2 Create Failed"
        exit(1)

    retval = create_vtermif('VtnTwo','VTermTwo','VTermIfTwo')
    if retval != 0:
        print "VTN2->VTERM2->VTERMIF2 Create Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnTwo','VTermTwo','VTermIfTwo','ControllerFirst')
    if retval != 0:
        print "VTN1->VTERM1->VTERMIF1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTN1->VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermTwo','ControllerFirst')
    if retval != 0:
        print "VTN2->VTERM2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne','ControllerFirst',position = 0)
    if retval != 0:
        print "After Create VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo','ControllerFirst',position = 0)
    if retval != 0:
        print "After Create VTN1 Validate Failed"
        exit(1)

    retval = delete_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
        print "VTN1->VTERM1->VTERMIF1 Delete Failed"
        exit(1)

    retval = delete_vtermif('VtnTwo','VTermTwo','VTermIfTwo')
    if retval != 0:
        print "VTN2->VTERM2->VTERMIF2 Delete Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "VTN1->VTERM1->VTERMIF1 Validate Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnTwo','VTermTwo','VTermIfTwo','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "VTN2->VTERM2->VTERMIF2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTN1->VTERM1 Validate Failed"
        exit(1)


    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermTwo','ControllerFirst')
    if retval != 0:
        print "VTN2->VTERM2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne','ControllerFirst',position = 0)
    if retval != 0:
        print "Before VTERM1 Delete VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo','ControllerFirst',position = 0)
    if retval != 0:
        print "Before VTERM2 Delete VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTN1->VTERM1 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo','VTermTwo')
    if retval != 0:
        print "VTN2->VTERM2 Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence = "no")
    if retval != 0:
        print "VTN1->VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermTwo','ControllerFirst',presence = "no")
    if retval != 0:
        print "VTN2->VTERM2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "After VTERM1 Delete VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "After VTERM1 Delete VTN1 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vtn('VtnTwo')
    if retval != 0:
        print "VTN2 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->VTERM1->VTERMIF1 and VTN2->VTERM2->VTERMIF2 TEST SUCCESS"
def test_vtn_multi_vterm_multi_controller():
    print "TEST 2 : 1 Tenants with 2 VTerminal each on different controllers"
    print "CONTROLLER1->VTNONE->VTERMONE->VTERMTWO"
    print "CONTROLLER2->VTNTWO->VTERMTHREE->VTERMFOUR"
    print "CREATE ControllerFirst"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller1 Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "Controller state check failed"
      exit(1)

    print "CREATE ControllerSecond"
    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "Controller2 Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerSecond',"up")
    if retval != 0:
      print "Controller state check failed"
      exit(1)

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

    retval = vtn_vterm.create_vtn('VtnTwo')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermTwo','ControllerFirst')
    if retval != 0:
        print "VTERM2 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo','VTermThree','ControllerSecond')
    if retval != 0:
        print "VTERM3 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo','VTermFour','ControllerSecond')
    if retval != 0:
        print "VTERM4 Create Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo','ControllerSecond')
    if retval != 0:
        print "VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermTwo','ControllerFirst',position=0)
    if retval != 0:
        print "VTERM2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermThree','ControllerSecond',position=0)
    if retval != 0:
        print "VTERM3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermFour','ControllerSecond')
    if retval != 0:
        print "VTERM4 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM1/VTN1 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermTwo')
    if retval != 0:
        print "VTERM2/VTN1 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo','VTermThree')
    if retval != 0:
        print "VTERM3/VTN2 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo','VTermFour')
    if retval != 0:
        print "VTERM4/VTN2 Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM1/VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermTwo','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM2/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermThree','ControllerSecond',presence="no")
    if retval != 0:
        print "VTERM3/VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermFour','ControllerSecond',presence="no")
    if retval != 0:
     print "VTERM4/VTN2 Validate Failed"
     exit(1)

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

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

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

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

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

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

    print "MULTI CONTROLLER MULTI VTERM VTN->VTERM TEST SUCCESS"
def test_vtn_vterm_multi_controller():
    print "TEST 1 : 1 Tenants with 1 VTerminal each on different controllers"
    print "CONTROLLER1->VTNONE->VTERMONE"
    print "CONTROLLER2->VTNONE->VTERMTWO"
    print "CREATE ControllerFirst"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "Controller state check failed"
      exit(1)

    print "CREATE ControllerSecond"
    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "Controller Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerSecond',"up")
    if retval != 0:
      print "Controller state check failed"
      exit(1)

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

    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermThree','ControllerSecond')
    if retval != 0:
        print "VTERM Create Failed"
        exit(1)

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

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

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERMOne Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermThree','ControllerSecond')
    if retval != 0:
        print "VTERMTwo Validate Failed"
        exit(1)

    retval  =  vtn_vterm.delete_vterm('VtnOne','VTermThree')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermThree','ControllerSecond',presence="no")
    if retval != 0:
        print "VtnVTERMTwo Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VtnVTERM Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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

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


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

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

    print "MULTI CONTROLLER VTN->VTERM TEST SUCCESS"
def test_multi_vtn_with_vterm_multi_controller_audit_test():
    print "TEST 3 : 2 Tenants with one VTerminal each in multi-controller and test AUDIT"
    print "CONTROLLER1->VTNONE->VTERMONE"
    print "CONTROLLER1->VTNTWO->VTERMONE"
    print "CONTROLLER2->VTNTHREE->VTERMONE"
    print "CONTROLLER2->VTNFOUR->VTERMONE"
    print "CREATE Controller"
    retval = controller.add_controller_ex("ControllerFirst")
    if retval != 0:
        print "Controller1 Create Failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = controller.add_controller_ex("ControllerSecond")
    if retval != 0:
        print "Controller2 Create Failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerSecond", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = vtn_vterm.create_vtn("VtnOne")
    if retval != 0:
        print "VTN1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vtn("VtnTwo")
    if retval != 0:
        print "VTN2 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vtn("VtnThree")
    if retval != 0:
        print "VTN3 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vtn("VtnFour")
    if retval != 0:
        print "VTN4 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm("VtnOne", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "VTERM1/VTN1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm("VtnTwo", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "VTERM1/VTN2 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm("VtnThree", "VTermThree", "ControllerSecond")
    if retval != 0:
        print "VTERM3/VTN3 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm("VtnFour", "VTermThree", "ControllerSecond")
    if retval != 0:
        print "VTERM3/VTN4 Create Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnOne", "ControllerFirst", position=0)
    if retval != 0:
        print "VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnTwo", "ControllerFirst", position=1)
    if retval != 0:
        print "VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnThree", "ControllerSecond", position=1)
    if retval != 0:
        print "VTN3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnFour", "ControllerSecond", position=0)
    if retval != 0:
        print "VTN4 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "VTERM1/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnTwo", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "VTERM1/VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnThree", "VTermThree", "ControllerSecond")
    if retval != 0:
        print "VTERM3/VTN3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnFour", "VTermThree", "ControllerSecond")
    if retval != 0:
        print "VTERM4/VTN4 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 "controller1 invalid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_invalid_ipaddr = vtn_testconfig.ReadValues(CONTROLLERDATA, "ControllerSecond")["invalid_ipaddr"]
    retval = controller.update_controller_ex("ControllerSecond", ipaddr=test_invalid_ipaddr)
    if retval != 0:
        print "controller2 invalid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerSecond", "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    print "****DELETE VTERM****"
    retval = vtn_vterm.delete_vterm("VtnOne", "VTermOne")
    if retval != 0:
        print "VTERM1/VTN1 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm("VtnTwo", "VTermOne")
    if retval != 0:
        print "VTERM1/VTN2 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm("VtnThree", "VTermThree")
    if retval != 0:
        print "VTERM3/VTN3 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm("VtnFour", "VTermThree")
    if retval != 0:
        print "VTERM3/VTN4 Delete 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 "controller1 valid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_controller_ipaddr = vtn_testconfig.ReadValues(CONTROLLERDATA, "ControllerSecond")["ipaddr"]
    retval = controller.update_controller_ex("ControllerSecond", ipaddr=test_controller_ipaddr)
    if retval != 0:
        print "controller2 valid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerSecond", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermOne", "ControllerFirst", presence="no")
    if retval != 0:
        print "VTERM1/VTN1 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vterm_at_controller("VtnTwo", "VTermOne", "ControllerFirst", presence="no")
    if retval != 0:
        print "VTERM1/VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnTwo", "ControllerFirst", presence="no")
    if retval != 0:
        print "VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnThree", "VTermThree", "ControllerSecond", presence="no")
    if retval != 0:
        print "VTERM3/VTN3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnThree", "ControllerSecond", presence="no")
    if retval != 0:
        print "VTN3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnFour", "VTermThree", "ControllerSecond", presence="no")
    if retval != 0:
        print "VTERM3/VTN4 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnFour", "ControllerSecond", presence="no")
    if retval != 0:
        print "VTN4 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vtn("VtnOne")
    if retval != 0:
        print "VTN1 Delete Failed in coordinator"
        exit(1)

    retval = vtn_vterm.delete_vtn("VtnTwo")
    if retval != 0:
        print "VTN2 Delete Failed in coordinator"
        exit(1)

    retval = vtn_vterm.delete_vtn("VtnThree")
    if retval != 0:
        print "VTN3 Delete Failed in coordinator"
        exit(1)

    retval = vtn_vterm.delete_vtn("VtnFour")
    if retval != 0:
        print "VTN4 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 "MULTI VTN->VTERM MULTI_CONTROLLER AUDIT TEST SUCCESS"
def test_vtn_vterm_audit_multi_controller_2():
    print """TEST 2 : create VTN and VTERM when controller is down
             change the controller status to up trigger Audit"""
    print "****CREATE Controller with valid IP****"
    retval = controller.add_controller_ex("ControllerFirst")
    if retval != 0:
        print "Controller1 Create Failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = controller.add_controller_ex("ControllerSecond")
    if retval != 0:
        print "Controller2 Create Failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerSecond", "up")
    if retval != 0:
        print "Controller state check 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 "controller1 invalid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_invalid_ipaddr = vtn_testconfig.ReadValues(CONTROLLERDATA, "ControllerSecond")["invalid_ipaddr"]
    retval = controller.update_controller_ex("ControllerSecond", ipaddr=test_invalid_ipaddr)
    if retval != 0:
        print "controller2 invalid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerSecond", "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    print "****Create VTN****"
    retval = vtn_vterm.create_vtn("VtnOne")
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    print "****Create VTERM****"
    retval = vtn_vterm.create_vterm("VtnOne", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "VTERM1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm("VtnOne", "VTermThree", "ControllerSecond")
    if retval != 0:
        print "VTERM3 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 "controller1 valid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_controller_ipaddr = vtn_testconfig.ReadValues(CONTROLLERDATA, "ControllerSecond")["ipaddr"]
    retval = controller.update_controller_ex("ControllerSecond", ipaddr=test_controller_ipaddr)
    if retval != 0:
        print "controller2 valid_ip update failed"
        exit(1)
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerSecond", "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller("VtnOne", "ControllerSecond")
    if retval != 0:
        print "VTN Validate Failed at controller2"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermThree", "ControllerSecond")
    if retval != 0:
        print "VTERM3 Validate Failed"
        exit(1)

    print "****Delete VTERM****"
    retval = vtn_vterm.delete_vterm("VtnOne", "VTermOne")
    if retval != 0:
        print "VTERM1/VTN Delete Failed"
        exit(1)

    iretval = vtn_vterm.delete_vterm("VtnOne", "VTermThree")
    if retval != 0:
        print "VTERM3/VTN Delete Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermOne", "ControllerFirst", presence="no")
    if retval != 0:
        print "VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermThree", "ControllerSecond", presence="no")
    if retval != 0:
        print "VTERM3 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller("VtnOne", "ControllerSecond", presence="no")
    if retval != 0:
        print "VTN Validate Failed at controller2"
        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 "VTN->VTERM Multi-controller AUDIT TEST SUCCESS"
def test_audit_vtn_vterm_vtermif():

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

    print "TEST 1: Test Audit VTenant with one VTerminal one VTERMIF"
    # Delay for AUDIT
    retval = controller.wait_until_state("ControllerFirst", "up")
    if retval != 0:
        print "controller state change failed"
        exit(1)

    retval = vtn_vterm.create_vtn("VtnOne")
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm("VtnOne", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "VTERM Create Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermOne", "ControllerFirst")
    if retval != 0:
        print "After Create VTERM Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller("VtnOne", "ControllerFirst")
    if retval != 0:
        print "VTN 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 = vtermif_portmap.create_vtermif("VtnOne", "VTermOne", "VTermIfOne")
    if retval != 0:
        print "VTERMIF 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 = vtermif_portmap.validate_vtermif_at_controller("VtnOne", "VTermOne", "VTermIfOne", "ControllerFirst")
    if retval != 0:
        print "After Create VTERMIF Validate Failed"
        exit(1)

    retval = vtermif_portmap.delete_vtermif("VtnOne", "VTermOne", "VTermIfOne")
    if retval != 0:
        print "VTERMIF Delete Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_at_controller(
        "VtnOne", "VTermOne", "VTermIfOne", "ControllerFirst", presence="no", position=0
    )
    if retval != 0:
        print "After Delete VTERMIF Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm("VtnOne", "VTermOne")
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller("VtnOne", "VTermOne", "ControllerFirst", presence="no")
    if retval != 0:
        print "After Delete VTERM Validate Failed"
        exit(1)

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

    retval = vtn_vterm.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->VTERM->VTERMIF AUDIT TEST SUCCESS"
Beispiel #14
0
def test_multi_vtn_with_vterm_audit_test():

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

    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)
    print "TEST 6 : 2 Tenants with one VTerminal each and test AUDIT"
    print "VTNONE->VTERMONE"
    print "VTNTWO->VTERMONE"

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

    retval = vtn_vterm.create_vtn('VtnTwo')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

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

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

    retval =  vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

    retval =  vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM 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 = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete 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 =  vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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


    retval =  vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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

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


    retval = vtn_vterm.delete_vtn('VtnTwo')
    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 "MULTI VTN->VTERM AUDIT TEST SUCCESS"
Beispiel #15
0
def test_vtn_vterm_audit_multi_controller_2():
    print """TEST 2 : create VTN and VTERM when controller is down
             change the controller status to up trigger Audit"""
    print "****CREATE Controller with valid IP****"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller1 Create Failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "Controller2 Create Failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "Controller state check 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 "controller1 invalid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst', "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_invalid_ipaddr = vtn_testconfig.ReadValues(
        CONTROLLERDATA, 'ControllerSecond')['invalid_ipaddr']
    retval = controller.update_controller_ex('ControllerSecond',
                                             ipaddr=test_invalid_ipaddr)
    if retval != 0:
        print "controller2 invalid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    print "****Create VTN****"
    retval = vtn_vterm.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    print "****Create VTERM****"
    retval = vtn_vterm.create_vterm('VtnOne', 'VTermOne', 'ControllerFirst')
    if retval != 0:
        print "VTERM1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermThree', 'ControllerSecond')
    if retval != 0:
        print "VTERM3 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 "controller1 valid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_controller_ipaddr = vtn_testconfig.ReadValues(
        CONTROLLERDATA, 'ControllerSecond')['ipaddr']
    retval = controller.update_controller_ex('ControllerSecond',
                                             ipaddr=test_controller_ipaddr)
    if retval != 0:
        print "controller2 valid_ip update failed"
        exit(1)

# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne', 'ControllerSecond')
    if retval != 0:
        print "VTN Validate Failed at controller2"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermOne',
                                                    'ControllerFirst')
    if retval != 0:
        print "VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermThree',
                                                    'ControllerSecond')
    if retval != 0:
        print "VTERM3 Validate Failed"
        exit(1)

    print "****Delete VTERM****"
    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermOne')
    if retval != 0:
        print "VTERM1/VTN Delete Failed"
        exit(1)

    iretval = vtn_vterm.delete_vterm('VtnOne', 'VTermThree')
    if retval != 0:
        print "VTERM3/VTN Delete Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermOne',
                                                    'ControllerFirst',
                                                    presence="no")
    if retval != 0:
        print "VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermThree',
                                                    'ControllerSecond',
                                                    presence="no")
    if retval != 0:
        print "VTERM3 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne',
                                                  'ControllerSecond',
                                                  presence="no")
    if retval != 0:
        print "VTN Validate Failed at controller2"
        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 "VTN->VTERM Multi-controller AUDIT TEST SUCCESS"
Beispiel #16
0
def test_multi_vterm_vtermif():

    print "CREATE Controller"
    print "VTNONE->VTERMONE->VTERMIFONE"
    print "VTNONE->VTERMTWO->VTERMIFTWO"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "TEST 3 :Controller Create Failed"
        exit(1)

    print "TEST 3 : One vtn and Two VTerminals with One Interfaces each"
  # Delay for AUDIT
    time.sleep(15)
    retval = vtn_vterm.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERMONE Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermTwo','ControllerFirst')
    if retval != 0:
        print "VTERMTWO Create Failed"
        exit(1)

    retval = create_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
        print "VTERMIFONE Create Failed"
        exit(1)
    retval = validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst')
    if retval != 0:
        print "VTERMIFONE Validate Failed"
        exit(1)

    retval = create_vtermif('VtnOne','VTermTwo','VTermIfTwo')
    if retval != 0:
        print "VTERMIFTWO Create Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnOne','VTermTwo','VTermIfTwo','ControllerFirst')
    if retval != 0:
        print "VTERMIFTWO Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',position = 0)
    if retval != 0:
        print "VTERMONE Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermTwo','ControllerFirst',position = 0)
    if retval != 0:
        print "VTERMTWO Validate Failed"
        exit(1)

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

    retval = delete_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
        print "VTERM1->VTERMIFONE Delete Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "VTERM1->VTERMIFONE Validate Failed"
        exit(1)

    retval = delete_vtermif('VtnOne','VTermTwo','VTermIfTwo')
    if retval != 0:
        print "VTERM1->VTERMIFTWO Delete Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnOne','VTermTwo','VTermIfTwo','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "VTERM2->VTERMIFTWO Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM1/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermTwo')
    if retval != 0:
        print "VTERM2/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "VTERM1/VTN Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermTwo','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "VTERM2/VTN Validate Failed"
        exit(1)

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

    retval = vtn_vterm.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->VTERM1->VTERMIF1 AND VTN1->VTERM2->VTERMIF2 TEST SUCCESS"
Beispiel #17
0
def test_multi_vtn_with_vterm_multi_controller_audit_test():
    print "TEST 3 : 2 Tenants with one VTerminal each in multi-controller and test AUDIT"
    print "CONTROLLER1->VTNONE->VTERMONE"
    print "CONTROLLER1->VTNTWO->VTERMONE"
    print "CONTROLLER2->VTNTHREE->VTERMONE"
    print "CONTROLLER2->VTNFOUR->VTERMONE"
    print "CREATE Controller"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller1 Create Failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "Controller2 Create Failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = vtn_vterm.create_vtn('VtnOne')
    if retval != 0:
        print "VTN1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vtn('VtnTwo')
    if retval != 0:
        print "VTN2 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vtn('VtnThree')
    if retval != 0:
        print "VTN3 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vtn('VtnFour')
    if retval != 0:
        print "VTN4 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermOne', 'ControllerFirst')
    if retval != 0:
        print "VTERM1/VTN1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo', 'VTermOne', 'ControllerFirst')
    if retval != 0:
        print "VTERM1/VTN2 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnThree', 'VTermThree',
                                    'ControllerSecond')
    if retval != 0:
        print "VTERM3/VTN3 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnFour', 'VTermThree',
                                    'ControllerSecond')
    if retval != 0:
        print "VTERM3/VTN4 Create Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo',
                                                  'ControllerFirst',
                                                  position=0)
    if retval != 0:
        print "VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnThree',
                                                  'ControllerSecond',
                                                  position=0)
    if retval != 0:
        print "VTN3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnFour',
                                                  'ControllerSecond',
                                                  position=0)
    if retval != 0:
        print "VTN4 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermOne',
                                                    'ControllerFirst')
    if retval != 0:
        print "VTERM1/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo', 'VTermOne',
                                                    'ControllerFirst')
    if retval != 0:
        print "VTERM1/VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnThree', 'VTermThree',
                                                    'ControllerSecond')
    if retval != 0:
        print "VTERM3/VTN3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnFour', 'VTermThree',
                                                    'ControllerSecond')
    if retval != 0:
        print "VTERM4/VTN4 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 "controller1 invalid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst', "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_invalid_ipaddr = vtn_testconfig.ReadValues(
        CONTROLLERDATA, 'ControllerSecond')['invalid_ipaddr']
    retval = controller.update_controller_ex('ControllerSecond',
                                             ipaddr=test_invalid_ipaddr)
    if retval != 0:
        print "controller2 invalid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    print "****DELETE VTERM****"
    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermOne')
    if retval != 0:
        print "VTERM1/VTN1 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo', 'VTermOne')
    if retval != 0:
        print "VTERM1/VTN2 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnThree', 'VTermThree')
    if retval != 0:
        print "VTERM3/VTN3 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnFour', 'VTermThree')
    if retval != 0:
        print "VTERM3/VTN4 Delete 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 "controller1 valid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_controller_ipaddr = vtn_testconfig.ReadValues(
        CONTROLLERDATA, 'ControllerSecond')['ipaddr']
    retval = controller.update_controller_ex('ControllerSecond',
                                             ipaddr=test_controller_ipaddr)
    if retval != 0:
        print "controller2 valid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermOne',
                                                    'ControllerFirst',
                                                    presence="no")
    if retval != 0:
        print "VTERM1/VTN1 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo',
                                                    'VTermOne',
                                                    'ControllerFirst',
                                                    presence="no")
    if retval != 0:
        print "VTERM1/VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo',
                                                  'ControllerFirst',
                                                  presence="no")
    if retval != 0:
        print "VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnThree',
                                                    'VTermThree',
                                                    'ControllerSecond',
                                                    presence="no")
    if retval != 0:
        print "VTERM3/VTN3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnThree',
                                                  'ControllerSecond',
                                                  presence="no")
    if retval != 0:
        print "VTN3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnFour',
                                                    'VTermThree',
                                                    'ControllerSecond',
                                                    presence="no")
    if retval != 0:
        print "VTERM3/VTN4 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnFour',
                                                  'ControllerSecond',
                                                  presence="no")
    if retval != 0:
        print "VTN4 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vtn('VtnTwo')
    if retval != 0:
        print "VTN2 Delete Failed in coordinator"
        exit(1)

    retval = vtn_vterm.delete_vtn('VtnThree')
    if retval != 0:
        print "VTN3 Delete Failed in coordinator"
        exit(1)

    retval = vtn_vterm.delete_vtn('VtnFour')
    if retval != 0:
        print "VTN4 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 "MULTI VTN->VTERM MULTI_CONTROLLER AUDIT TEST SUCCESS"
Beispiel #18
0
def test_vtn_vterm_vtermif_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 VTerminal one VTERMIF and One PORTMAP"
  # Delay for AUDIT
    time.sleep(15)
    retval = vtn_vterm.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM Create Failed"
        exit(1)

    retval = create_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
        print "VTERMIF Create Failed"
        exit(1)
    retval = validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst')
    if retval != 0:
        print "After Create VTERMIF Validate Failed"
        exit(1)

    retval = create_portmap('VtnOne','VTermOne','VTermIfOne');
    if retval != 0:
        print "Portmap Create Failed"
        exit(1)

    retval = validate_vtermif_portmap_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence = "yes");
    if retval != 0:
        print "Portmap Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "After Create VTERM Validate Failed"
        exit(1)

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

    retval = delete_portmap('VtnOne','VTermOne','VTermIfOne');
    if retval != 0:
        print "Portmap Delete Failed"
        exit(1)

    retval = delete_vtermif('VtnOne','VTermOne','VTermIfOne')
    if retval != 0:
        print "VTERMIF Delete Failed"
        exit(1)

    retval = validate_vtermif_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence = "no",position = 0)
    if retval != 0:
        print "After Delete VTERMIF Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence = "no")
    if retval != 0:
        print "After Delete VTERM Validate Failed"
        exit(1)

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

    retval = vtn_vterm.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->VTERM->VTERMIF->PORTMAP TEST SUCCESS"
def test_vtn_vterm_audit_1():

    print "****CREATE Controller with valid IP****"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller Create Failed"
        exit(1)

    print """TEST 1 : create VTN and VTERM when controller is up
             change the controller status to down delete VTN and VTERM
             trigger Audit"""
  # Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)
    print "****Create VTN****"
    retval = vtn_vterm.create_vtn('VtnOne')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    print "****Create VTERM****"
    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)


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


    retval =  vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM 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)

    print "****Delete VTERM****"
    retval = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    print "****Delete VTN****"
    retval = vtn_vterm.delete_vtn('VtnOne')
    if retval != 0:
        print "VTN Delete Failed in coordinator"
        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 =  vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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


    print "DELETE CONTROLLER"
    retval = controller.delete_controller_ex('ControllerFirst')
    if retval != 0:
        print "CONTROLLER delete failed"
        exit(1)
    print "VTN->VTERM AUDIT TEST SUCCESS"
def test_vtn_multi_vterm_multi_controller():
    print "TEST 2 : 1 Tenants with 2 VTerminal each on different controllers"
    print "CONTROLLER1->VTNONE->VTERMONE->VTERMTWO"
    print "CONTROLLER2->VTNTWO->VTERMTHREE->VTERMFOUR"
    print "CREATE ControllerFirst"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller1 Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerFirst', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    print "CREATE ControllerSecond"
    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "Controller2 Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

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

    retval = vtn_vterm.create_vtn('VtnTwo')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermOne', 'ControllerFirst')
    if retval != 0:
        print "VTERM1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermTwo', 'ControllerFirst')
    if retval != 0:
        print "VTERM2 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo', 'VTermThree', 'ControllerSecond')
    if retval != 0:
        print "VTERM3 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo', 'VTermFour', 'ControllerSecond')
    if retval != 0:
        print "VTERM4 Create Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo', 'ControllerSecond')
    if retval != 0:
        print "VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermOne',
                                                    'ControllerFirst')
    if retval != 0:
        print "VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermTwo',
                                                    'ControllerFirst',
                                                    position=1)
    if retval != 0:
        print "VTERM2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo',
                                                    'VTermThree',
                                                    'ControllerSecond',
                                                    position=1)
    if retval != 0:
        print "VTERM3 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo', 'VTermFour',
                                                    'ControllerSecond')
    if retval != 0:
        print "VTERM4 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermOne')
    if retval != 0:
        print "VTERM1/VTN1 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermTwo')
    if retval != 0:
        print "VTERM2/VTN1 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo', 'VTermThree')
    if retval != 0:
        print "VTERM3/VTN2 Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo', 'VTermFour')
    if retval != 0:
        print "VTERM4/VTN2 Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermOne',
                                                    'ControllerFirst',
                                                    presence="no")
    if retval != 0:
        print "VTERM1/VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermTwo',
                                                    'ControllerFirst',
                                                    presence="no")
    if retval != 0:
        print "VTERM2/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo',
                                                    'VTermThree',
                                                    'ControllerSecond',
                                                    presence="no")
    if retval != 0:
        print "VTERM3/VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo',
                                                    'VTermFour',
                                                    'ControllerSecond',
                                                    presence="no")
    if retval != 0:
        print "VTERM4/VTN2 Validate Failed"
        exit(1)

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

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

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

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

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

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

    print "MULTI CONTROLLER MULTI VTERM VTN->VTERM TEST SUCCESS"
def test_multi_vtn_with_vterm_audit_test():

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

    retval = controller.wait_until_state('ControllerFirst',"up")
    if retval != 0:
      print "controller state change failed"
      exit(1)
    print "TEST 6 : 2 Tenants with one VTerminal each and test AUDIT"
    print "VTNONE->VTERMONE"
    print "VTNTWO->VTERMONE"

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

    retval = vtn_vterm.create_vtn('VtnTwo')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

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

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

    retval =  vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

    retval =  vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermOne','ControllerFirst')
    if retval != 0:
        print "VTERM 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 = vtn_vterm.delete_vterm('VtnOne','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo','VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete 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 =  vtn_vterm.validate_vterm_at_controller('VtnOne','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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


    retval =  vtn_vterm.validate_vterm_at_controller('VtnTwo','VTermOne','ControllerFirst',presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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

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


    retval = vtn_vterm.delete_vtn('VtnTwo')
    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 "MULTI VTN->VTERM AUDIT TEST SUCCESS"
def test_multi_vtn_with_vterm_multi_controller():
    print "TEST 3 : 2 Tenants with one VTerminal each"
    print "CONTROLLER1->VTNONE->VTERMONE"
    print "CONTROLLER1->VTNTWO->VTERMONE"
    print "CONTROLLER2->VTNONE->VTERMONE"
    print "CONTROLLER2->VTNTWO->VTERMONE"
    print "CREATE Controller"
    retval = controller.add_controller_ex('ControllerFirst')
    if retval != 0:
        print "Controller1 Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerFirst', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "Controller2 Create Failed"
        exit(1)
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

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

    retval = vtn_vterm.create_vtn('VtnTwo')
    if retval != 0:
        print "VTN Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermOne', 'ControllerFirst')
    if retval != 0:
        print "VTERM1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo', 'VTermOne', 'ControllerFirst')
    if retval != 0:
        print "VTERM2 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermThree', 'ControllerSecond')
    if retval != 0:
        print "VTERM3 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnTwo', 'VTermThree', 'ControllerSecond')
    if retval != 0:
        print "VTERM4 Create Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne',
                                                  'ControllerFirst',
                                                  position=0)
    if retval != 0:
        print "VTN1/CONTROLLER1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo',
                                                  'ControllerFirst',
                                                  position=1)
    if retval != 0:
        print "VTN2/CONTROLLER2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne',
                                                  'ControllerSecond',
                                                  position=0)
    if retval != 0:
        print "VTN1/CONTROLLER2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vtn_at_controller('VtnTwo',
                                                  'ControllerSecond',
                                                  position=1)
    if retval != 0:
        print "VTN2/CONTROLLER2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermOne',
                                                    'ControllerFirst')
    if retval != 0:
        print "VTERM1/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo', 'VTermOne',
                                                    'ControllerFirst')
    if retval != 0:
        print "VTERM1/VTN2 Validate Failed "
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermThree',
                                                    'ControllerSecond')
    if retval != 0:
        print "VTERM2/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo', 'VTermThree',
                                                    'ControllerSecond')
    if retval != 0:
        print "VTERM2/VTN2 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermOne',
                                                    'ControllerFirst',
                                                    presence="no")
    if retval != 0:
        print "VTERM Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vterm('VtnTwo', 'VTermOne')
    if retval != 0:
        print "VTERM/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo',
                                                    'VTermOne',
                                                    'ControllerFirst',
                                                    presence="no")
    if retval != 0:
        print "VTERM2 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermThree')
    if retval != 0:
        print "VTERM2/VTN1 Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermThree',
                                                    'ControllerSecond',
                                                    presence="no")
    if retval != 0:
        print "VTERM2/VTN1 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnTwo', 'VTermThree')
    if retval != 0:
        print "VTERM2/VTN2 Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnTwo',
                                                    'VTermThree',
                                                    'ControllerSecond',
                                                    presence="no")
    if retval != 0:
        print "VTERM2/VTN2 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.delete_vtn('VtnTwo')
    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 "MULTI VTN->VTERM MULTI-CONTROLLER TEST SUCCESS"
Beispiel #23
0
def test_audit_vtn_vterm_vtermif_portmap_multi_controller():

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

    retval = controller.add_controller_ex('ControllerSecond')
    if retval != 0:
        print "TEST 4 :Controller2 Create Failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    print "TEST 4 : VTenant with one VTerminal one VTERMIF and One PORTMAP with multi-controller"

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

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermOne', 'ControllerFirst')
    if retval != 0:
        print "VTERM1 Create Failed"
        exit(1)

    retval = vtn_vterm.create_vterm('VtnOne', 'VTermThree', 'ControllerSecond')
    if retval != 0:
        print "VTERM3 Create Failed"
        exit(1)

    retval = vtermif_portmap.create_vtermif('VtnOne', 'VTermOne', 'VTermIfOne')
    if retval != 0:
        print "VTERMIF1 Create Failed"
        exit(1)

    retval = vtermif_portmap.create_vtermif('VtnOne', 'VTermThree',
                                            'VTermIfTwo')
    if retval != 0:
        print "VTERMIF2 Create Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_at_controller(
        'VtnOne', 'VTermOne', 'VTermIfOne', 'ControllerFirst')
    if retval != 0:
        print "After Create VTERMIF1 Validate Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_at_controller(
        'VtnOne', 'VTermThree', 'VTermIfTwo', 'ControllerSecond')
    if retval != 0:
        print "After Create VTERMIF2 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 "controller1 invalid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst', "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_invalid_ipaddr = vtn_testconfig.ReadValues(
        CONTROLLERDATA, 'ControllerSecond')['invalid_ipaddr']
    retval = controller.update_controller_ex('ControllerSecond',
                                             ipaddr=test_invalid_ipaddr)
    if retval != 0:
        print "controller2 invalid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "down")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = vtermif_portmap.create_portmap('VtnOne', 'VTermOne', 'VTermIfOne')
    if retval != 0:
        print "Portmap1 Create Failed"
        exit(1)

    retval = vtermif_portmap.create_portmap('VtnOne', 'VTermThree',
                                            'VTermIfTwo')
    if retval != 0:
        print "Portmap2 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 "controller1 valid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerFirst', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    test_controller_ipaddr = vtn_testconfig.ReadValues(
        CONTROLLERDATA, 'ControllerSecond')['ipaddr']
    retval = controller.update_controller_ex('ControllerSecond',
                                             ipaddr=test_controller_ipaddr)
    if retval != 0:
        print "controller2 valid_ip update failed"
        exit(1)
# Delay for AUDIT
    retval = controller.wait_until_state('ControllerSecond', "up")
    if retval != 0:
        print "Controller state check failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_portmap_at_controller(
        'VtnOne', 'VTermOne', 'VTermIfOne', 'ControllerFirst', presence="yes")
    if retval != 0:
        print "Portmap1 Validate Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_portmap_at_controller(
        'VtnOne',
        'VTermThree',
        'VTermIfTwo',
        'ControllerSecond',
        presence="yes")
    if retval != 0:
        print "Portmap2 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermOne',
                                                    'ControllerFirst')
    if retval != 0:
        print "After Create VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne', 'VTermThree',
                                                    'ControllerSecond')
    if retval != 0:
        print "After Create VTERM3 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne', 'ControllerSecond')
    if retval != 0:
        print "VTN Validate Failed at controller2"
        exit(1)

    retval = vtermif_portmap.delete_portmap('VtnOne', 'VTermOne', 'VTermIfOne')
    if retval != 0:
        print "Portmap1 Delete Failed"
        exit(1)

    retval = vtermif_portmap.delete_portmap('VtnOne', 'VTermThree',
                                            'VTermIfTwo')
    if retval != 0:
        print "Portmap2 Delete Failed"
        exit(1)

#    retval=vtermif_portmap.validate_vtermif_portmap_at_controller('VtnOne','VTermOne','VTermIfOne','ControllerFirst',presence="no");
#    if retval != 0:
#        print "After Delete Portmap1 Validate Failed"
#        exit(1)

#    retval=vtermif_portmap.validate_vtermif_portmap_at_controller('VtnOne','VTermThree','VTermIfTwo','ControllerSecond',presence="no");
#    if retval != 0:
#        print "After Delete Portmap2 Validate Failed"
#        exit(1)

    retval = vtermif_portmap.delete_vtermif('VtnOne', 'VTermOne', 'VTermIfOne')
    if retval != 0:
        print "VTERMIF1 Delete Failed"
        exit(1)

    retval = vtermif_portmap.delete_vtermif('VtnOne', 'VTermThree',
                                            'VTermIfTwo')
    if retval != 0:
        print "VTERMIF2 Delete Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_at_controller('VtnOne',
                                                            'VTermOne',
                                                            'VTermIfOne',
                                                            'ControllerFirst',
                                                            presence="no",
                                                            position=0)
    if retval != 0:
        print "After Delete VTERMIF1 Validate Failed"
        exit(1)

    retval = vtermif_portmap.validate_vtermif_at_controller('VtnOne',
                                                            'VTermThree',
                                                            'VTermIfTwo',
                                                            'ControllerSecond',
                                                            presence="no",
                                                            position=0)
    if retval != 0:
        print "After Delete VTERMIF2 Validate Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermOne')
    if retval != 0:
        print "VTERM1/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.delete_vterm('VtnOne', 'VTermThree')
    if retval != 0:
        print "VTERM3/VTN Delete Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermOne',
                                                    'ControllerFirst',
                                                    presence="no")
    if retval != 0:
        print "After Delete VTERM1 Validate Failed"
        exit(1)

    retval = vtn_vterm.validate_vterm_at_controller('VtnOne',
                                                    'VTermThree',
                                                    'ControllerSecond',
                                                    presence="no")
    if retval != 0:
        print "After Delete VTERM2 Validate Failed"
        exit(1)

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

    retval = vtn_vterm.validate_vtn_at_controller('VtnOne',
                                                  'ControllerSecond',
                                                  presence="no")
    if retval != 0:
        print "VTN Validate Failed after VTERM3 Deleted at controller2"
        exit(1)

    retval = vtn_vterm.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 "VTN->VTERM->VTERMIF->PORTMAP MULTI-CONTROLER TEST SUCCESS"