Ejemplo n.º 1
0
def cleanModules (desc, output, args):
	
	modules = args["clean"]
	app.info ("Cleaning up ... ")
	
	if "vm" in modules or "all" in modules:
		app.info ("Cleaning VMs")
		vm.deleteAll (desc, output, args)

	if "vol" in modules or "all" in modules:
	        app.info ("Cleaning volumes")
        	volume.deleteAll (desc, output, args)

	if "net" in modules or "all" in modules:
	        app.info ("Cleaning routers")
        	router.deleteAll (desc, output, args)

	        app.info ("Cleaning subnets")
        	subnet.deleteAll (desc, output, args)

		app.info ("Cleaning all networks")
        	net.deleteAll (desc, output, args)

	if "flv" in modules or "all" in modules:
        	app.info ("Cleaning all flavors")
        	flavor.deleteAll (desc, output, args)

	if "img" in modules or "all" in modules:
        	app.info  ("Cleaning all images")
        	image.deleteAll (desc, output, args)
Ejemplo n.º 2
0
def setupModules (desc, output, args):

	modules = args["setup"]
    	name = desc["VNF"]["name"]
    	app.info ("Setting up " + name)
	
	if "net" in modules or "all" in modules:
		if desc["VNF"]["network"] != []:
        		app.info ("Setting up network:")
	        	net.create (desc, output, args)

			app.info ("Setting up subnets:")
	        	subnet.create (desc, output, args)
    		else:
        		app.notfound ("network configuration")
    
	    	if desc["VNF"]["router"] != []:
        		app.info ("Setting up routers:")
	        	router.create (desc, output, args)
	    	else:
        		app.notfound ("router configuration")


	if "flv" in modules or "all" in modules:	
		if desc["VNF"]["vm"] != []:
        		app.info ("Setting up flavors:")
	        	flavor.create (desc, output, args)
		else:
        		app.notfound ("VM configuration")


	if "img" in modules or "all" in modules:
		if desc["VNF"]["vm"] != []:
			app.info ("Setting up images:")
		        image.create (desc, output, args)
		else:
        		app.notfound ("VM configuration")


	if "vol" in modules or "all" in modules:
		if desc["VNF"]["vm"] != []:
			app.info ("Setting up volumes:")
			volume.create (desc, output, args)
		else:
			app.info ("volume configuration")


	if "vm" in modules or "all" in modules:
		if desc["VNF"]["vm"] != []:
        		app.info ("Setting up VMs:")
        		vm.create (desc, output, args)
    		else:
        		app.info ("VM configuration")
Ejemplo n.º 3
0
def removeModules (desc, output, args):

	modules = args["remove"]
    	name = desc["VNF"]["name"]
    	app.info ("Removing " + name)

	if "vm" in modules or "all" in modules:
		if desc["VNF"]["vm"] != []:
        		app.info ("Removing VMs")
        		vm.delete (desc, output, args)
    		else:
        		app.notfound ("VM configuration")


        if "vol" in modules or "all" in modules:
                if desc["VNF"]["vm"] != []:
                        app.info ("Removing volumes:")
                        volume.delete (desc, output, args)
                else:
                        app.notfound ("volume configuration")


	if "net" in modules or "all" in modules:
    		if desc["VNF"]["router"] != []:  
        		app.info ("Removing routers:")
        		router.delete (desc, output, args)
    		else:
        		app.notfound ("router configuration")

    		if desc["VNF"]["network"] != []:
			app.info ("Removing subnets:")
			subnet.delete (desc, output, args)

			app.info ("Removing networks:")
        		net.delete (desc, output, args)
    		else:
        		app.notfound ("network configuration")
	

	if "flv" in modules or "all" in modules:
    		if desc["VNF"]["vm"] != []:
        		app.info ("Removing flavors:")
        		flavor.delete (desc, output, args)
    		else:
        		app.notfound ("VM configuration")


	if "img" in modules or "all" in modules:
    		if desc["VNF"]["vm"] != []:
			app.info ("Removing images:")
        		image.delete (desc ,output, args)
    		else:
        		app.notfound ("VM configuration")