"""
# TODO what to return UUID / given name / internal name ?
logging.debug("RPC CALL: compute start")
- logging.info('nwlist2: {0}'.format(network))
try:
c = self.dcs.get(dc_label).startCompute(
compute_name, image=image, command=command, network=network)
def compute_profile(self, dc_label, compute_name, image, kwargs):
# note: zerorpc does not support keyword arguments
+ ## VIM/dummy gatekeeper's tasks:
# start vnf
vnf_status = self.compute_action_start(self, dc_label, compute_name, image,
kwargs.get('network'),
kwargs.get('command'))
-
# start traffic source (with fixed ip addres, no use for now...)
- self.compute_action_start(self, dc_label, 'psrc', 'profile_source', [{'id':'output','ip':'10.0.10.1/24'}], None)
+ self.compute_action_start(self, dc_label, 'psrc', 'profile_source', [{'id':'output'}], None)
+ # link vnf to traffic source
+ DCNetwork = self.dcs.get(dc_label).net
+ DCNetwork.setChain()
+
if args.get("network") is not None:
nw_list = self._parse_network(args.get("network"))
- pp.pprint('nwlist1: {0}'.format(nw_list))
-
r = self.c.compute_action_start(
args.get("datacenter"),
args.get("name"),
nw_list = list()
if args.get("network") is not None:
nw_list = self._parse_network(args.get("network"))
- logging.info('nwlist: {0}'.format(nw_list))
+
+ params = self._create_dict(
+ network=nw_list,
+ command=args.get("docker_command"),
+ input=args.get("input"),
+ output=args.get("output"))
+
r = self.c.compute_profile(
args.get("datacenter"),
args.get("name"),
args.get("image"),
- network=nw_list,
- command=args.get("docker_command"),
- input=args.get("input"),
- output=args.get("output")
+ params
)
pp.pprint(r)
+ def _create_dict(self, **kwargs):
+ return kwargs
+
def _parse_network(self, network_str):
'''
parse the options for all network interfaces of the vnf
if isinstance(node1, Docker):
if "id" in params["params1"]:
node1_port_id = params["params1"]["id"]
+ node1_port_name = link.intf1.name
node2_port_id = node2.ports[link.intf2]
if isinstance(node2, Docker):
if "id" in params["params2"]:
node2_port_id = params["params2"]["id"]
-
+ node2_port_name = link.intf2.name
# add edge and assigned port number to graph in both directions between node1 and node2
attr_dict[attr] = attr_number
- attr_dict2 = {'src_port_id': node1_port_id, 'src_port': node1.ports[link.intf1],
- 'dst_port_id': node2_port_id, 'dst_port': node2.ports[link.intf2]}
+ attr_dict2 = {'src_port_id': node1_port_id, 'src_port_nr': node1.ports[link.intf1],
+ 'src_port_name': node1_port_name,
+ 'dst_port_id': node2_port_id, 'dst_port_nr': node2.ports[link.intf2],
+ 'dst_port_name': node2_port_name}
attr_dict2.update(attr_dict)
self.DCNetwork_graph.add_edge(node1.name, node2.name, attr_dict=attr_dict2)
- attr_dict2 = {'src_port_id': node2_port_id, 'src_port': node2.ports[link.intf2],
- 'dst_port_id': node1_port_id, 'dst_port': node1.ports[link.intf1]}
+ attr_dict2 = {'src_port_id': node2_port_id, 'src_port_nr': node2.ports[link.intf2],
+ 'src_port_name': node2_port_name,
+ 'dst_port_id': node1_port_id, 'dst_port_nr': node1.ports[link.intf1],
+ 'dst_port_name': node1_port_name}
attr_dict2.update(attr_dict)
self.DCNetwork_graph.add_edge(node2.name, node1.name, attr_dict=attr_dict2)
# connect all given networks
# if no --net option is given, network = [{}], so 1 empty dict in the list
# this results in 1 default interface with a default ip address
- logging.info('nwlist: {0}'.format(network))
for nw in network:
# TODO we cannot use TCLink here (see: https://github.com/mpeuster/dockernet/issues/3)
logging.info('nw: {0}'.format(nw))
- self.net.addLink(d, self.switch, params1=nw, cls=Link)
+ self.net.addLink(d, self.switch, params1=nw, cls=Link, intfName1=nw.get('id'))
# do bookkeeping
self.containers[name] = d
return d # we might use UUIDs for naming later on