Пример #1
0
 def connect(self):
     self.client = client.Client(host=self.hostname,
                                 sol005=True,
                                 **self.kwargs)
     if self.client:
         return True
     else:
         return False
Пример #2
0
 def upload_nsd_package(self, package_path, package_name=None):
     # re-init client
     try:
         self.client = client.Client(host=self.hostname,
                                     sol005=True,
                                     **self.kwargs)
         return self.client.nsd.create(package_path)
     except ClientException as e:
         LOG.error(e)
         raise
Пример #3
0
def auth():
    config = dotenv_values(".env")
    kwargs = {}
    if config["USER_OSM"] is not None:
        kwargs['user'] = config["USER_OSM"]
    if config["PASSWORD_OSM"] is not None:
        kwargs['password'] = config["PASSWORD_OSM"]
    if config["PROJECT_OSM"] is not None:
        kwargs['project'] = config["PROJECT_OSM"]
    myclient = client.Client(host=config["HOSTNAME_OSM"],
                             sol005=True,
                             **kwargs)
    return myclient
Пример #4
0
    def __init__(self,
                 host="127.0.0.1",
                 user=None,
                 password=None,
                 project=None):

        kwargs = {}
        if user is not None:
            kwargs['user'] = user
        if password is not None:
            kwargs['password'] = password
        if project is not None:
            kwargs['project'] = project
        self.client = client.Client(host=host, sol005=True, **kwargs)
Пример #5
0
def init_osm_client(osm_params):
    c = None
    try:
        c = client.Client(host=osm_params['osm_host'],
                          sol005=True,
                          user=osm_params['osm_user'],
                          password=osm_params['osm_password'],
                          project=osm_params['osm_project'],
                          **osm_params)
    except Exception as e:
        print(e)
        exit(1)

    return c
Пример #6
0
 def __init__(self,
              osmhost,
              sol005=None,
              ro_host=None,
              descriptors_dir=None,
              vnfd_descriptors_list=None,
              nsd_descriptors_list=None,
              ns_name_prefix=None):
     self._OsmApi = client.Client(host=osmhost,
                                  sol005=sol005,
                                  ro_host=ro_host,
                                  verbose=2)
     self._descriptors_dir = descriptors_dir
     self.vnfd_descriptors_list = vnfd_descriptors_list
     self.nsd_descriptors_list = nsd_descriptors_list
     self.ns_name_prefix = ns_name_prefix
Пример #7
0
def cli(ctx, hostname, so_port, so_project, ro_hostname, ro_port, sol005):
    if hostname is None:
        print((
            "either hostname option or OSM_HOSTNAME " +
            "environment variable needs to be specified"))
        exit(1)
    kwargs={}
    if so_port is not None:
        kwargs['so_port']=so_port
    if so_project is not None:
        kwargs['so_project']=so_project
    if ro_hostname is not None:
        kwargs['ro_host']=ro_hostname
    if ro_port is not None:
        kwargs['ro_port']=ro_port
    
    ctx.obj = client.Client(host=hostname, sol005=sol005, **kwargs)
Пример #8
0
    def __init__(self, host, username, password, tenant_name, vim_name,
                 vim_username, vim_password, domain_id, domain_name, nfvo_id,
                 nfvo_name):

        self.client = osm.Client(host=host,
                                 user=username,
                                 password=password,
                                 so_project=tenant_name)

        self.vim_name = vim_name
        self._vim_username = vim_username
        self._vim_password = vim_password
        self.nfvo_name = nfvo_name
        self.domain_name = domain_name
        self.domain_id = domain_id
        self.nfvo_id = nfvo_id

        self.vim_id = self._get_vim_id()
Пример #9
0
    return vnfd


hostname = "fgcn-backflip3.cs.upb.de"
user = "******"
password = "******"
project = "admin"
kwargs = {}

if user is not None:
    kwargs['user'] = user
if password is not None:
    kwargs['password'] = password
if project is not None:
    kwargs['project'] = project
myclient = client.Client(host=hostname, sol005=True, **kwargs)
myclient.vnfd.create("hackfest_cloudinit_vnf.tar.gz")

# Begin tar.gzip yaml extractor
# Haydar

tarf = tarfile.open("hackfest_cloudinit_vnf.tar.gz", 'r:gz')
members = tarf.getmembers()
new_tar = tarfile.open("new_vnfd.tar.gz", "w:gz")

print("opened tar.gz archive")

for member in members:
    member_name = member.name
    if member_name.endswith(".yaml") or member_name.endswith(".yml"):
        member_contents = tarf.extractfile(member)
Пример #10
0
def scale_vnf():
    cl = client.Client(host='localhost', sol005=True)
    print(cl.ns.scale_vnf("idb", "4", "apache_autoscale", False, True, False))
Пример #11
0
from osmclient import client

hostname = "10.0.13.252"
myclient = client.Client(host=hostname)


def turn_off_cameras():
    myclient.ns.delete("non_static_5g_mobility")


def turn_on_cameras():
    myclient.ns.create("non_static_5g_mobility-ns", "non_static_5g_mobility", "Openstack")