def __init__(self,path=None): # read from config file current_path = os.path.dirname(os.path.abspath( __file__ )) if path is None: conf_file_path = os.path.join(current_path, "../../../../conf/se-config.yaml") else: conf_file_path = os.path.join(current_path, path) stream = open(conf_file_path, "r") initial_config = yaml.load(stream) self.configured_interfaces = self.convert_config_into_Resources_datamodel(initial_config["interfaces"]) self.initial_configured_interfaces = initial_config["interfaces"] # Dynamic import of provisioning plugin (default: ryu_rest_of) try: self.provision_plugin = initial_config["provision_plugin"] except: self.provision_plugin = "ryu_rest_of" # Push port status from configuration file into SE-db # TODO: Add other rspec parameters to db db_sync_manager.update_resources(self.configured_interfaces, fromConfigFile=True) self.component_id_prefix = "urn:publicid:IDN+fms:" + initial_config["organisation"] + ":serm" self.component_manager_prefix = "urn:publicid:IDN+fms:" + initial_config["organisation"] + ":serm+authority+cm" self.vlan_trans = initial_config["vlan_trans"] self.qinq = initial_config["qinq"] self.capacity = initial_config["capacity"] self.dpid = initial_config["dpid"]
def __init__(self, path=None): # read from config file current_path = os.path.dirname(os.path.abspath(__file__)) if path is None: conf_file_path = os.path.join(current_path, "../../../../conf/se-config.yaml") else: conf_file_path = os.path.join(current_path, path) stream = open(conf_file_path, "r") initial_config = yaml.load(stream) self.configured_interfaces = self.convert_config_into_Resources_datamodel( initial_config["interfaces"]) self.initial_configured_interfaces = initial_config["interfaces"] # Dynamic import of provisioning plugin (default: ryu_rest_of) try: self.provision_plugin = initial_config["provision_plugin"] except: self.provision_plugin = "ryu_rest_of" # Push port status from configuration file into SE-db # TODO: Add other rspec parameters to db db_sync_manager.update_resources(self.configured_interfaces, fromConfigFile=True) self.component_id_prefix = "urn:publicid:IDN+fms:" + initial_config[ "organisation"] + ":serm" self.component_manager_prefix = "urn:publicid:IDN+fms:" + initial_config[ "organisation"] + ":serm+authority+cm" self.vlan_trans = initial_config["vlan_trans"] self.qinq = initial_config["qinq"] self.capacity = initial_config["capacity"] self.dpid = initial_config["dpid"]
def free_resource_reservation(self, resources): for resource in resources: r_splited = resource['port'].rsplit("_", 1) vlan = resource['vlan'] port = r_splited[1] self.set_concrete_port_status(port, vlan, True) # Update the SE-db db_sync_manager.update_resources(self.configured_interfaces)