- def delete_of_controller(self, of_id):
- """
- Delete an openflow controller from DB.
- :param of_id: openflow controller dpid
- :return:
- """
+ if ofc_data.get("ip") or ofc_data.get("port"):
+ if not ofc_data.get("ip") or not ofc_data.get("port"):
+ raise SdnException("Provide or both 'ip' and 'port'")
+ db_wim_update["wim_url"] = "{}:{}".format(ofc_data["ip"], ofc_data["port"])
+
+ if ofc_data.get("dpid"):
+ db_wim_account_config["dpid"] = ofc_data["dpid"]
+ if ofc_data.get("version"):
+ db_wim_account_config["version"] = ofc_data["version"]
+
+ if db_wim_account_config:
+ db_wim_account_update["config"] = yaml.load(wim_account["config"], Loader=yaml.Loader) or {}
+ db_wim_account_update["config"].update(db_wim_account_config)
+ db_wim_account_update["config"] = yaml.safe_dump(db_wim_account_update["config"], default_flow_style=True,
+ width=256)
+
+ if db_wim_account_update:
+ self.db.update_rows('wim_accounts', db_wim_account_update, WHERE={'uuid': of_id})
+ if db_wim_update:
+ self.db.update_rows('wims', db_wim_update, WHERE={'uuid': wim_account["wim_id"]})
+
+ def _get_of_controller(self, of_id):