Example #1
0
#!/usr/bin/python
from resources.resources import PhysicalNetworks
from resources.shell import Shell

Shell(PhysicalNetworks()).delete()
#!/usr/bin/python
from resources.resources import VirtualMachines
from resources.shell import Shell

Shell(VirtualMachines()).reset(
    VirtualMachines.PASSWORD_FOR_VM, VirtualMachines.PASSWORD)
Example #3
0
#!/usr/bin/python
from __future__ import print_function
import os
import sys

from resources.resources import VlanIpRanges
from resources.shell import Shell

args = sys.argv
f = os.path.basename(args[0])

if len(args) == 2:
    Shell(VlanIpRanges()).create(cidr=args[1])

elif len(args) == 3:
    Shell(VlanIpRanges()).create(cidr=args[1], network=args[2])

elif len(args) == 4 and args[2] == 'vlan':
    Shell(VlanIpRanges()).create(cidr=args[1], vlan=args[3])

elif len(args) == 4:
    Shell(VlanIpRanges()).create(cidr=args[1],
                                 start_ip=args[2],
                                 end_ip=args[3])

elif len(args) == 5:
    Shell(VlanIpRanges()).create(cidr=args[1],
                                 start_ip=args[2],
                                 end_ip=args[3],
                                 network=args[4])
Example #4
0
#!/usr/bin/python
from resources.resources import VirtualMachines
from resources.shell import Shell

Shell(VirtualMachines()).expunge()
#!/usr/bin/python
from __future__ import print_function
import os
import sys

from resources.resources import PhysicalNetworks 
from resources.shell import Shell

args = sys.argv
f = os.path.basename(args[0])

if len(args) == 3:
    Shell(PhysicalNetworks()).update(entity=args[1], tags=args[2],
                                     asynchronous=True)

else:
    print('Usage: {} {{physical-network}} {{tag}}'.format(f))
Example #6
0
#!/usr/bin/python
from __future__ import print_function
import sys

from resources.resources import FirewallRules
from resources.shell import Shell

args = sys.argv

if len(args) == 3 and args[1] == 'for-ip':
    Shell(FirewallRules()).print_all(filter_dict={'ip': args[2]})

elif len(args) == 2 and args[1] not in {'-h', '--help'}:
    Shell(FirewallRules()).print_entity(args[1])

elif len(args) == 1:
    Shell(FirewallRules()).print_all()

else:
    print('Usage: {} [{{id or name}}|for-ip {{ip-id}}]'.format(args[0]))
#!/usr/bin/python
from resources.resources import Routers
from resources.shell import Shell

Shell(Routers()).list()
#!/usr/bin/python
from resources.resources import NuageVspDevices
from resources.shell import Shell
import sys

args = sys.argv

if len(args) == 4:
    Shell(NuageVspDevices()).update(phys_net=args[1],
                                    username=args[2],
                                    password=args[3])

else:
    print('Usage: {} {{physical-network}} {{username}} {{password}}'.
          format(args[0]))
#!/usr/bin/python
from resources.resources import Configurations
from resources.shell import Shell

Shell(Configurations()).update_class_attribute().on_success(
    'A management server(s) restart may be necessary.')
from resources.shell import Shell

args = sys.argv
f = os.path.basename(args[0])

if len(args) > 1 and args[1] in {'shared',
                                 'shared_configdrive',
                                 'isolated',
                                 'isolated_configdrive',
                                 'nuage_shared',
                                 'nuage_shared_configdrive',
                                 'nuage_isolated',
                                 'nuage_isolated_configdrive'}:

    if len(args) == 2:
        Shell(NetworkOfferings()).create(
            keyword=args[1], short_duration=True).exit()

    elif len(args) == 3 and args[2] == 'for-vpc':
        Shell(NetworkOfferings()).create(
            keyword=args[1], short_duration=True, for_vpc=True).exit()

    elif len(args) == 3 and args[2] != 'for-vpc' and args[2] != 'no-userdata':
        Shell(NetworkOfferings()).create(
            keyword=args[1], short_duration=True, name=args[2]).exit()

    elif len(args) == 4 and args[2] == 'for-vpc' and args[3] != 'no-userdata':
        Shell(NetworkOfferings()).create(
            keyword=args[1], short_duration=True, name=args[3],
            for_vpc=True).exit()

    elif len(args) == 3 and args[2] != 'for-vpc' and args[2] == 'no-userdata':
#!/usr/bin/python
from resources.resources import VPCs
from resources.shell import Shell

Shell(VPCs()).restart()
#!/usr/bin/python
# replaced by Nuage version for underlay extensibility
# from resources.resources import VlanIpRanges
from resources.resources import NuageUnderlayVlanIpRanges \
    as VlanIpRanges
from resources.shell import Shell

Shell(VlanIpRanges()).list()
Example #13
0
#!/usr/bin/python
from resources.resources import VirtualMachines
from resources.shell import Shell

Shell(VirtualMachines()).reboot()
Example #14
0
#!/usr/bin/python
from resources.resources import Zones
from resources.shell import Shell

Shell(Zones()).list()
Example #15
0
#!/usr/bin/python
from resources.resources import Configurations
from resources.shell import Shell

Shell(Configurations()).list(table_format=True)
Example #16
0
#!/usr/bin/python
from resources.resources import VlanIpRanges
from resources.shell import Shell

Shell(VlanIpRanges()).delete_sync()
Example #17
0
#!/usr/bin/python
from __future__ import print_function
import sys

from resources.resources import VPCOfferings
from resources.shell import Shell

args = sys.argv

if len(args) == 2 and args[1] in {'nuage', 'nuage_configdrive'}:
    Shell(VPCOfferings()).create_async(short_duration=True,
                                       keyword=args[1],
                                       until_completion=True)

elif (len(args) == 3 and args[1] in {'nuage', 'nuage_configdrive'}
      and args[2] != 'no-userdata'):
    Shell(VPCOfferings()).create_async(short_duration=True,
                                       keyword=args[1],
                                       name=args[2],
                                       until_completion=True)

elif (len(args) == 3 and args[1] in {'nuage', 'nuage_configdrive'}
      and args[2] == 'no-userdata'):
    Shell(VPCOfferings()).create_async(short_duration=True,
                                       keyword=args[1],
                                       user_data=False,
                                       until_completion=True)

elif (len(args) == 3 and args[1] in {'nuage', 'nuage_configdrive'}
      and args[3] == 'no-userdata'):
    Shell(VPCOfferings()).create_async(short_duration=True,
#!/usr/bin/python
from resources.resources import Domains
from resources.shell import Shell

Shell(Domains()).list()
#!/usr/bin/python
from resources.resources import NetworkOfferings
from resources.shell import Shell

Shell(NetworkOfferings()).delete_sync()
Example #20
0
#!/usr/bin/python
from resources.resources import VirtualMachines
from resources.shell import Shell

Shell(VirtualMachines()).destroy()
Example #21
0
#!/usr/bin/python
from resources.resources import NetworkOfferings
from resources.shell import Shell

Shell(NetworkOfferings()).list()
#!/usr/bin/python
from resources.resources import IpAddresses
from resources.shell import Shell

Shell(IpAddresses()).release()
Example #23
0
#!/usr/bin/python
from resources.resources import SSHKeyPairs
from resources.shell import Shell

Shell(SSHKeyPairs()).list()
Example #24
0
#!/usr/bin/python
from resources.resources import IpAddresses
from resources.shell import Shell

Shell(IpAddresses()).list()
Example #25
0
#!/usr/bin/python
from __future__ import print_function
import os
import sys

from resources.resources import FirewallRules
from resources.shell import Shell

args = sys.argv
f = os.path.basename(args[0])

if len(args) == 4 and args[2].lower() in ['tcp', 'udp', 'icmp']:
    Shell(FirewallRules()).create(
        ip_address=args[1], protocol=args[2], port=args[3],
        short_duration=True
    )

elif len(args) == 4:
    Shell(FirewallRules()).create(
        ip_address=args[1], cidr=args[2], protocol=args[3],
        short_duration=True
    )

elif len(args) == 5:
    Shell(FirewallRules()).create(
        ip_address=args[1], cidr=args[2], protocol=args[3], port=args[4],
        short_duration=True
    )

else:
    print('Usage: '
#!/usr/bin/python
from resources.resources import VPCs
from resources.shell import Shell

Shell(VPCs()).list()
Example #27
0
#!/usr/bin/python
from __future__ import print_function
import os
import sys

from resources.resources import IpAddresses
from resources.shell import Shell

args = sys.argv
f = os.path.basename(args[0])

if len(args) == 3:
    Shell(IpAddresses()).associate(ip=args[1], vm=args[2])

elif len(args) == 4:
    Shell(IpAddresses()).associate(ip=args[1], tier=args[2], vm=args[3])

else:
    print('{} {{public-ip}} {{tier}} {{vm}}'.format(f))
    print('  (tier is mandatory in case of associating to vm within vpc)')
#!/usr/bin/python
from __future__ import print_function
import os
import sys

from resources.resources import VirtualMachines
from resources.shell import Shell


def to_array(networks):
    return [net for net in networks.split(',')]


args = sys.argv
f = os.path.basename(args[0])
until_c = Shell.define_until_completion(args, False)
vm = None

if len(args) == 3:
    vm = Shell(VirtualMachines()).deploy(name=args[1],
                                         networks=to_array(args[2]),
                                         until_completion=until_c,
                                         short_duration=False)

elif len(args) == 4:
    vm = Shell(VirtualMachines()).deploy(name=args[1],
                                         networks=to_array(args[2]),
                                         template=args[3],
                                         until_completion=until_c,
                                         short_duration=False)
Example #29
0
#!/usr/bin/python
from resources.resources import Users
from resources.shell import Shell

Shell(Users()).list()
#!/usr/bin/python
from resources.resources import Templates
from resources.shell import Shell

Shell(Templates()).delete()