X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=n2vc%2Fvnf.py;h=74f4d9432d0efdd7b4e508a4429627bab0c8f537;hb=refs%2Ftags%2Fv6.0.0;hp=11ce3c82cc1a1dad5f9cc9cc0bf6c0e60d194723;hpb=8bf1041b5ce6398f9997aeb3564dfbe7e732bf0c;p=osm%2FN2VC.git diff --git a/n2vc/vnf.py b/n2vc/vnf.py index 11ce3c8..74f4d94 100644 --- a/n2vc/vnf.py +++ b/n2vc/vnf.py @@ -287,9 +287,10 @@ class N2VC: vdu: ... - relation: - - provides: dataVM:db - requires: mgmtVM:app + vca-relationships: + relation: + - provides: dataVM:db + requires: mgmtVM:app This tells N2VC that the charm referred to by the dataVM vdu offers a relation named 'db', and the mgmtVM vdu has an 'app' endpoint that should be connected to a database. @@ -340,8 +341,8 @@ class N2VC: for cfg in configs: if 'juju' in cfg: juju = cfg['juju'] - if 'relation' in juju: - for rel in juju['relation']: + if 'vca-relationships' in juju and 'relation' in juju['vca-relationships']: + for rel in juju['vca-relationships']['relation']: try: # get the application name for the provides @@ -503,10 +504,19 @@ class N2VC: # Where to deploy the charm to. to=to, ) - - # Map the vdu id<->app name, - # - await self.Relate(model_name, vnfd) + ############################# + # Map the vdu id<->app name # + ############################# + try: + await self.Relate(model_name, vnfd) + except KeyError as ex: + # We don't currently support relations between NS and VNF/VDU charms + self.log.warn("[N2VC] Relations not supported: {}".format(ex)) + except Exception as ex: + # This may happen if not all of the charms needed by the relation + # are ready. We can safely ignore this, because Relate will be + # retried when the endpoint of the relation is deployed. + self.log.warn("[N2VC] Relations not ready") # ####################################### # # Execute initial config primitive(s) #