password_to_encrypt = "password"
config_to_encrypt = {}
+ def _obtain_url(self, input, create):
+ if input.get("ip") or input.get("port"):
+ if not input.get("ip") or not input.get("port") or input.get('url'):
+ raise ValidationError("You must provide both 'ip' and 'port' (deprecated); or just 'url' (prefered)")
+ input['url'] = "http://{}:{}/".format(input["ip"], input["port"])
+ del input["ip"]
+ del input["port"]
+ elif create and not input.get('url'):
+ raise ValidationError("You must provide 'url'")
+ return input
+
+ def _validate_input_new(self, input, force=False):
+ input = super()._validate_input_new(input, force)
+ return self._obtain_url(input, True)
+
+ def _validate_input_edit(self, input, force=False):
+ input = super()._validate_input_edit(input, force)
+ return self._obtain_url(input, False)
+
class K8sClusterTopic(CommonVimWimSdn):
topic = "k8sclusters"
sdn_properties = {
"name": name_schema,
+ "type": {"type": "string"},
+ "url": {"type": "string"},
+ "user": shortname_schema,
+ "password": passwd_schema,
+ "config": {"type": "object"},
"description": description_schema,
+ # The folowing are deprecated. Maintanied for backward compatibility
"dpid": dpid_Schema,
"ip": ip_schema,
"port": port_schema,
- "type": {"type": "string", "enum": ["opendaylight", "floodlight", "onos"]},
"version": {"type": "string", "minLength": 1, "maxLength": 12},
- "user": shortname_schema,
- "password": passwd_schema
}
sdn_new_schema = {
"title": "sdn controller information schema",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": sdn_properties,
- "required": ["name", "port", 'ip', 'dpid', 'type'],
+ "required": ["name", 'type'],
"additionalProperties": False
}
sdn_edit_schema = {