Beispiel #1
0
    if osPlatform == 'linux':
        testPlatform.Authenticate(username, password)

    if osPlatform in ['linux', 'windowsConnectionMgr']:
        session = testPlatform.Sessions.add()

    if osPlatform == 'windows':
        # Windows support only one session. Id is always equal 1.
        session = testPlatform.Sessions.find(Id=1)

    # ixNetwork is the root object to the IxNetwork API hierarchical tree.
    ixNetwork = session.Ixnetwork

    # Instantiate the helper class objects
    statObj = Statistics(ixNetwork)
    portObj = Ports(ixNetwork)

    if osPlatform == 'windows':
        ixNetwork.NewConfig()

    print('\nConfiguring license server')
    ixNetwork.Globals.Licensing.LicensingServers = licenseServerIp
    ixNetwork.Globals.Licensing.Mode = licenseMode

    # Create vport for RAW Traffic Item source/dest endpoints
    vport1 = ixNetwork.Vport.add(Name='Port1')
    vport2 = ixNetwork.Vport.add(Name='Port2')

    # getVportList=True because you already created vports from above.
    # If you did not create vports, then assignPorts will create them and name them with default names.
Beispiel #2
0
    if osPlatform == 'linux':
        testPlatform.Authenticate(username, password)

    if osPlatform in ['linux', 'windowsConnectionMgr']:
        session = testPlatform.Sessions.add()

    if osPlatform == 'windows':
        # Windows support only one session. Id is always equal 1.
        session = testPlatform.Sessions.find(Id=1)

    # ixNetwork is the root object to the IxNetwork API hierarchical tree.
    ixNetwork = session.Ixnetwork

    # Instantiate the helper class objects
    statObj = Statistics(ixNetwork)
    portObj = Ports(ixNetwork)

    if osPlatform == 'windows':
        ixNetwork.NewConfig()

    print('\nConfiguring license server')
    ixNetwork.Globals.Licensing.LicensingServers = licenseServerIp
    ixNetwork.Globals.Licensing.Mode = licenseMode

    # Create vports and name them so you could get the vports by the name when creating Topology.
    vport1 = ixNetwork.Vport.add(Name='Port1')
    vport2 = ixNetwork.Vport.add(Name='Port2')

    # getVportList=True because you already created vports.
    # If you did not create vports, then assignPorts will create them and name them with default names.
Beispiel #3
0
try:
    testPlatform = TestPlatform(apiServerIp, rest_port=apiServerPort, platform=osPlatform)

    # Console output verbosity: None|request|request_response
    testPlatform.Trace = 'request_response'

    if osPlatform == 'linux':
        testPlatform.Authenticate(username, password)
        ixNetwork.ApiKey = '9277fc8fe92047f6a126f54481ba07fc'
        session = ixNetwork.Sessions(Id=8)
        ixNetwork = session.Ixnetwork

    if osPlatform == 'windows':
        # Windows support only one session. Id is always equal 1.
        session = testPlatform.Sessions.find(Id=1)
    
    # ixNetwork is the root object to the IxNetwork API tree.
    ixNetwork = session.Ixnetwork

    # Instantiate the helper class objects
    statObj = Statistics(ixNetwork)
    portObj = Ports(ixNetwork)

    ipv4 = ixNetwork.Topology.find(Name='Topo1').DeviceGroup.find(Name='DG1').Ethernet.find(Name='Eth1').Ipv4.find(Name='Ipv4')
    print(ipv4)
    #ipv4.SendArp(2)

except Exception as errMsg:
    print('\nrestPy.Exception:', errMsg)