Ejemplo n.º 1
0
# Specify parameters of the Edge to be created - as argument
p_or_s = 'None'

while p_or_s != 'p' and p_or_s != 's':
    p_or_s = raw_input(
        "Which edge do you want to configure? \n primary - p, secondary - s    p/s[p]: "
    ) or 'p'

if p_or_s == 'p':
    path = 'inputs/pe_primary_' + seldc(sys.argv[1:]) + '.yml'
else:
    path = 'inputs/pe_secondary_' + seldc(sys.argv[1:]) + '.yml'

# Create an instance of Class vSphere
cred = credentials(inputs)
nsx = NSX(*cred)

with open(path, 'r') as f:
    s = f.read()

# Read the directory of credentials from file
pe = yaml.load(s)

# Find the edge
print('\nSearching for edge-id')
try:
    edgeid = nsx.findedge(pe['name'])
except:
    print("Edge doesn't exist")
    sys.exit(1)
Ejemplo n.º 2
0
#! /usr/bin/env python
"""
===================================================================================================
   Description:    template for quick testing of NSX methods
===================================================================================================
"""

from nsx import NSX
from nsx import credentials

cred = credentials('inputs/nsx_mylab.yml')
nsx = NSX(*cred)

# Continue with calling methods of NSX class etc.
nsx.getedges()
nsx.getswitches()