X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Fvnf.py;h=bb7b871f8e7f9a2de0dc1dfbde29058e030013a7;hp=04ad3016ebf6c6829a299f6ca4c9d36696e7b7d6;hb=e5406c6f652b4248763e114629764633da941650;hpb=ce31bc3e331c7050d1d74e9b0821dbf99c12fc96 diff --git a/n2vc/vnf.py b/n2vc/vnf.py index 04ad301..bb7b871 100644 --- a/n2vc/vnf.py +++ b/n2vc/vnf.py @@ -287,9 +287,10 @@ class N2VC: vdu: ... - relation: - - provides: dataVM:db - requires: mgmtVM:app + vca-relations: + 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. @@ -339,8 +340,9 @@ class N2VC: # Loop through relations for cfg in configs: if 'juju' in cfg: - if 'relation' in juju: - for rel in juju['relation']: + juju = cfg['juju'] + if 'vca-relations' in juju and 'relations' in juju['vca-relations']: + for rel in juju['vca-relations']['relation']: try: # get the application name for the provides @@ -502,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) #