LOG = logging.getLogger("dcemulator.net")
LOG.setLevel(logging.DEBUG)
+# default CPU period used for cpu percentage-based cfs values (microseconds)
+CPU_PERIOD = 1000000
+
class DCNetwork(Containernet):
"""
Wraps the original Mininet/Containernet class and provides
"""
def __init__(self, controller=RemoteController, monitor=False,
- enable_learning=False, # learning switch behavior of the default ovs switches icw Ryu controller can be turned off/on, neede for E-LAN functionality
+ enable_learning=False, # learning switch behavior of the default ovs switches icw Ryu controller can be turned off/on, needed for E-LAN functionality
dc_emulation_max_cpu=1.0, # fraction of overall CPU time for emulation
dc_emulation_max_mem=512, # emulation max mem in MB
**kwargs):
# initialize resource model registrar
self.rm_registrar = ResourceModelRegistrar(
dc_emulation_max_cpu, dc_emulation_max_mem)
+ self.cpu_period = CPU_PERIOD
def addDatacenter(self, label, metadata={}, resource_log_path=None):
"""
def _addMonitorFlow(self, vnf_src_name, vnf_dst_name, vnf_src_interface=None, vnf_dst_interface=None,
tag=None, **kwargs):
+ """
+ Add a monitoring flow entry that adds a special flowentry/counter at the begin or end of a chain.
+ So this monitoring flowrule exists on top of a previously defined chain rule and uses the same vlan tag/routing.
+ :param vnf_src_name:
+ :param vnf_dst_name:
+ :param vnf_src_interface:
+ :param vnf_dst_interface:
+ :param tag: vlan tag to be used for this chain (same tag as existing chain)
+ :param monitor_placement: 'tx' or 'rx' indicating to place the extra flowentry resp. at the beginning or end of the chain
+ :return:
+ """
src_sw = None
src_sw_inport_nr = 0
kwargs['switch_outport_name'] = dst_sw_outport_name
kwargs['skip_vlan_tag'] = True
- monitor_placement = kwargs.get('monitor_placement')
+ monitor_placement = kwargs.get('monitor_placement').strip()
# put monitor flow at the dst switch
insert_flow = False
if monitor_placement == 'tx' and path.index(current_hop) == 0: # first node:
# put monitoring flow at the src switch
elif monitor_placement == 'rx' and path.index(current_hop) == len(path) - 1: # last node:
insert_flow = True
- else:
+ elif monitor_placement not in ['rx', 'tx']:
LOG.exception('invalid monitor command: {0}'.format(monitor_placement))
:param cookie: cookie for the installed flowrules (can be used later as identifier for a set of installed chains)
:param match: custom match entry to be added to the flowrules (default: only in_port and vlan tag)
:param priority: custom flowrule priority
+ :param monitor: boolean to indicate whether this chain is a monitoring chain
+ :param tag: vlan tag to be used for this chain (pre-defined or new one if none is specified)
:return: output log string
"""
return ret
else:
# no chain existing (or E-LAN) -> install normal chain
- LOG.warning('*** installing monitoring chain without pre-defined chain from {0}:{1} -> {2}:{3}'.
+ LOG.warning('*** installing monitoring chain without pre-defined NSD chain from {0}:{1} -> {2}:{3}'.
format(vnf_src_name, vnf_src_interface, vnf_dst_name, vnf_dst_interface))
pass