コード例 #1
0
===================================================================================================
"""

from nsx import NSX
from nsx import credentials
from nsx import createbody
from nsx import seldc
import yaml

from termcolor import cprint
import sys

from deepdiff import DeepDiff

# Select the instance of NSX manager to be configured - as argument
inputs = 'inputs/nsx_' + seldc(sys.argv[1:]) + '.yml'

# 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
コード例 #2
0
ファイル: nsx_edge_findid.py プロジェクト: germanium-git/NSX
#! /usr/bin/env python
"""
===================================================================================================
   Author:         Petr Nemec
   Description:    Resolves edge name to edge-id
   Date:           2017-10-04
===================================================================================================
"""

from nsx import NSX
from nsx import credentials
from nsx import seldc
import sys

# Select the instance of NSX manager to be configured - as argument
inputs = 'inputs/nsx_' + seldc(sys.argv[1:]) + '.yml'

# NSX Manager credentials
cred = credentials(inputs)
nsx = NSX(*cred)

# Input the name of edge
edgename = raw_input("Edge name: ")

print(nsx.findedge(edgename))