X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rwlaunchpad%2Ftest%2Flaunchpad.py;h=b73c500053d4f8a825c3d4f724d357f18608c36e;hb=a3bb91f092d378448cb870eccd45d43865de143c;hp=53e4d361e6ee8dc65bf62b95f33efcd83d0f5ae4;hpb=f04e0aed7b77ad8833fa18ee083b5332bdb0da20;p=osm%2FSO.git diff --git a/rwlaunchpad/test/launchpad.py b/rwlaunchpad/test/launchpad.py index 53e4d361..b73c5000 100755 --- a/rwlaunchpad/test/launchpad.py +++ b/rwlaunchpad/test/launchpad.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# +# # Copyright 2016 RIFT.IO Inc # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,6 +40,7 @@ import rift.rwcal.cloudsim.net from rift.vcs.ext import ClassProperty + logger = logging.getLogger(__name__) @@ -282,6 +283,32 @@ class AutoscalerTasklet(rift.vcs.core.Tasklet): plugin_directory = ClassProperty('./usr/lib/rift/plugins/rwautoscaler') plugin_name = ClassProperty('rwautoscaler') +class StagingManagerTasklet(rift.vcs.core.Tasklet): + """ + A class that provide a simple staging area for all tasklets + """ + + def __init__(self, name='StagingManager', uid=None, + config_ready=True, + recovery_action=core.RecoveryType.FAILCRITICAL.value, + data_storetype=core.DataStore.NOSTORE.value, + ): + """ + Creates a StagingMangerTasklet object. + + Arguments: + name - the name of the tasklet + uid - a unique identifier + + """ + super(StagingManagerTasklet, self).__init__(name=name, uid=uid, + config_ready=config_ready, + recovery_action=recovery_action, + data_storetype=data_storetype, + ) + + plugin_directory = ClassProperty('./usr/lib/rift/plugins/rwstagingmgr') + plugin_name = ClassProperty('rwstagingmgr') def get_ui_ssl_args(): """Returns the SSL parameter string for launchpad UI processes""" @@ -343,6 +370,60 @@ class ConfigManagerTasklet(rift.vcs.core.Tasklet): plugin_directory = ClassProperty('./usr/lib/rift/plugins/rwconmantasklet') plugin_name = ClassProperty('rwconmantasklet') + +class ProjectMgrManoTasklet(rift.vcs.core.Tasklet): + """ + This class represents a Resource Manager tasklet. + """ + + def __init__(self, name='Project-Manager-Mano', uid=None, + config_ready=True, + recovery_action=core.RecoveryType.FAILCRITICAL.value, + data_storetype=core.DataStore.NOSTORE.value, + ): + """ + Creates a ProjectMgrManoTasklet object. + + Arguments: + name - the name of the tasklet + uid - a unique identifier + """ + super(ProjectMgrManoTasklet, self).__init__(name=name, uid=uid, + config_ready=config_ready, + recovery_action=recovery_action, + data_storetype=data_storetype, + ) + + plugin_directory = ClassProperty('./usr/lib/rift/plugins/rwprojectmano') + plugin_name = ClassProperty('rwprojectmano') + + +class PackageManagerTasklet(rift.vcs.core.Tasklet): + """ + This class represents a Resource Manager tasklet. + """ + + def __init__(self, name='Package-Manager', uid=None, + config_ready=True, + recovery_action=core.RecoveryType.FAILCRITICAL.value, + data_storetype=core.DataStore.NOSTORE.value, + ): + """ + Creates a PackageManager object. + + Arguments: + name - the name of the tasklet + uid - a unique identifier + """ + super(PackageManagerTasklet, self).__init__(name=name, uid=uid, + config_ready=config_ready, + recovery_action=recovery_action, + data_storetype=data_storetype, + ) + + plugin_directory = ClassProperty('./usr/lib/rift/plugins/rwpkgmgr') + plugin_name = ClassProperty('rwpkgmgr') + class GlanceServer(rift.vcs.NativeProcess): def __init__(self, name="glance-image-catalog", config_ready=True, @@ -369,10 +450,12 @@ class Demo(rift.vcs.demo.Demo): GlanceServer(), rift.vcs.DtsRouterTasklet(), rift.vcs.MsgBrokerTasklet(), - rift.vcs.RestPortForwardTasklet(), rift.vcs.RestconfTasklet(), rift.vcs.RiftCli(), rift.vcs.uAgentTasklet(), + rift.vcs.IdentityManagerTasklet(), + rift.vcs.ProjectManagerTasklet(), + ProjectMgrManoTasklet(), rift.vcs.Launchpad(), ] @@ -393,12 +476,15 @@ class Demo(rift.vcs.demo.Demo): restart_procs = [ VnfmTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), VnsTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), - MonitorTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), + # MonitorTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), MonitoringParameterTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), NsmTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), ResMgrTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), ImageMgrTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), AutoscalerTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), + PackageManagerTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), + StagingManagerTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), + ProjectMgrManoTasklet(recovery_action=core.RecoveryType.RESTART.value, data_storetype=datastore), ] if not mgmt_ip_list or len(mgmt_ip_list) == 0: @@ -426,6 +512,16 @@ class Demo(rift.vcs.demo.Demo): stby_lp_vm.add_tasklet(rift.vcs.uAgentTasklet(), mode_active=False) colony.append(stby_lp_vm) + if ha_mode == "LSS": + stby_lp_vm_2 = rift.vcs.VirtualMachine( + name='launchpad-vm-3', + ip=mgmt_ip_list[2], + procs=standby_procs, + start=False, + ) + stby_lp_vm_2.add_tasklet(rift.vcs.uAgentTasklet(), mode_active=False) + colony.append(stby_lp_vm_2) + sysinfo = rift.vcs.SystemInfo( mode='ethsim', zookeeper=rift.vcs.manifest.RaZookeeper(master_ip=mgmt_ip_list[0]), @@ -470,7 +566,6 @@ def main(argv=sys.argv[1:]): # since it doesn't need it and it will fail within containers os.environ["NO_KERNEL_MODS"] = "1" - cleanup_dir_name = None if os.environ["INSTALLDIR"] in ["/", "/home/rift", "/home/rift/.install", "/usr/rift/build/fc20_debug/install/usr/rift", "/usr/rift"]: @@ -514,15 +609,23 @@ def main(argv=sys.argv[1:]): #load demo info and create Demo object demo = Demo(args.no_ui, ha_mode, mgmt_ip_list, args.test_name) - # Create the prepared system from the demo - system = rift.vcs.demo.prepared_system_from_demo_and_args(demo, args, - northbound_listing="cli_launchpad_schema_listing.txt", - netconf_trace_override=True) - - confd_ip = socket.gethostbyname(socket.gethostname()) - intf = netifaces.ifaddresses('eth0') - if intf and netifaces.AF_INET in intf and len(intf[netifaces.AF_INET]): - confd_ip = intf[netifaces.AF_INET][0]['addr'] + system = rift.vcs.demo.prepared_system_from_demo_and_args( + demo, args, + northbound_listing=["platform_schema_listing.txt", + "platform_mgmt_schema_listing.txt", + "cli_launchpad_schema_listing.txt"], + netconf_trace_override=True) + + # Search for externally accessible IP address with netifaces + gateways = netifaces.gateways() + # Check for default route facing interface and then get its ip address + if 'default' in gateways: + interface = gateways['default'][netifaces.AF_INET][1] + confd_ip = netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['addr'] + else: + # no default gateway. Revert to 127.0.0.1 + confd_ip = "127.0.0.1" + # TODO: This need to be changed when launchpad starts running on multiple VMs rift.vcs.logger.configure_sink(config_file=None, confd_ip=confd_ip) # Start the prepared system @@ -531,6 +634,7 @@ def main(argv=sys.argv[1:]): if __name__ == "__main__": resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY) ) + os.system('/usr/rift/bin/UpdateHostsFile') try: main() except rift.vcs.demo.ReservationError: