def __init__(self, dcs):
self.dcs = dcs
- def compute_action_start(self, dc_label, compute_name, image, network):
+ def compute_action_start(self, dc_label, compute_name, image, command, network):
# network e.g. {"ip": "10.0.0.254/8"}
# TODO what to return UUID / given name / internal name ?
logging.debug("RPC CALL: compute start")
try:
c = self.dcs.get(dc_label).startCompute(
- compute_name, image=image, network=network)
+ compute_name, image=image, command=command, network=network)
return str(c.name)
except Exception as ex:
logging.exception("RPC error.")
\r
def connectDCNetwork(self, net):\r
self.net = net\r
- logging.info("Connected DCNetwork(%s) to API endpoint %s(%s:%d)" % (\r
- net.name, self.__class__.__name__, self.ip, self.port))\r
+ logging.info("Connected DCNetwork to API endpoint %s(%s:%d)" % (\r
+ self.__class__.__name__, self.ip, self.port))\r
\r
def start(self):\r
thread = threading.Thread(target=self._api_server_thread, args=())\r
args.get("datacenter"),
args.get("name"),
args.get("image"),
+ args.get("docker_command"),
network)
pp.pprint(r)
"--name", "-n", dest="name",
help="Name of compute instance e.g. 'vnf1'")
parser.add_argument(
- "--image", dest="image",
+ "--image","-i", dest="image",
help="Name of container image to be used e.g. 'ubuntu'")
+parser.add_argument(
+ "--dcmd", "-c", dest="docker_command",
+ help="Startup command of the container e.g. './start.sh'")
parser.add_argument(
"--net", dest="network",
help="Network properties of compute instance e.g. '10.0.0.123/8'")
network.main(sys.argv[2:])
elif sys.argv[1] == "datacenter":
datacenter.main(sys.argv[2:])
- elif sys.argv[1] == "monitor":
+ elif sys.argv[1] == "monitor":
monitor.main(sys.argv[2:])
if __name__ == '__main__':
"""
Wrapper for addDocker method to use custom container class.
"""
- self.DCNetwork_graph.add_node(name)
- return Dockernet.addDocker(self, name, cls=EmulatorCompute, **params)
+ self.DCNetwork_graph.add_node(label)
+ return Dockernet.addDocker(self, label, cls=EmulatorCompute, **params)
- def removeDocker( self, name, **params ):
+ def removeDocker( self, label, **params ):
"""
Wrapper for removeDocker method to update graph.
"""
- self.DCNetwork_graph.remove_node(name)
- return Dockernet.removeDocker(self, name, **params)
+ self.DCNetwork_graph.remove_node(label)
+ return Dockernet.removeDocker(self, label, **params)
def addSwitch( self, name, add_to_graph=True, **params ):
"""
from mininet.log import setLogLevel
from dcemulator.net import DCNetwork
from api.zerorpcapi import ZeroRpcApiEndpoint
+from api.zerorpcapi_DCNetwork import ZeroRpcApiEndpointDCNetwork
logging.basicConfig(level=logging.INFO)