Feature 10239: Distributed VCA
- Handle VCATopic: https://osm.etsi.org/gerrit/#/c/osm/NBI/+/10574/
- Pass vca_id to calls in N2VC, so N2VC can know to which VCA it needs
to talk
Depends on the following patch: https://osm.etsi.org/gerrit/#/c/osm/N2VC/+/10616/
Change-Id: I080c1aab94f70de83f2d33def74ccd03450dbdd6
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/osm_lcm/lcm.py b/osm_lcm/lcm.py
index 659a57c..ebfca7e 100644
--- a/osm_lcm/lcm.py
+++ b/osm_lcm/lcm.py
@@ -104,7 +104,7 @@
self.config["ro_config"]["uri"] = self.config["ro_config"]["uri"][index+1]
self.loop = loop or asyncio.get_event_loop()
- self.ns = self.netslice = self.vim = self.wim = self.sdn = self.k8scluster = self.k8srepo = None
+ self.ns = self.netslice = self.vim = self.wim = self.sdn = self.k8scluster = self.vca = self.k8srepo = None
# logging
log_format_simple = "%(asctime)s %(levelname)s %(name)s %(filename)s:%(lineno)s %(message)s"
@@ -309,6 +309,17 @@
task = asyncio.ensure_future(self.k8scluster.delete(params, order_id))
self.lcm_tasks.register("k8scluster", k8scluster_id, order_id, "k8scluster_delete", task)
return
+ elif topic == "vca":
+ if command == "create" or command == "created":
+ vca_id = params.get("_id")
+ task = asyncio.ensure_future(self.vca.create(params, order_id))
+ self.lcm_tasks.register("vca", vca_id, order_id, "vca_create", task)
+ return
+ elif command == "delete" or command == "deleted":
+ vca_id = params.get("_id")
+ task = asyncio.ensure_future(self.vca.delete(params, order_id))
+ self.lcm_tasks.register("vca", vca_id, order_id, "vca_delete", task)
+ return
elif topic == "k8srepo":
if command == "create" or command == "created":
k8srepo_id = params.get("_id")
@@ -486,7 +497,7 @@
self.first_start = True
while self.consecutive_errors < 10:
try:
- topics = ("ns", "vim_account", "wim_account", "sdn", "nsi", "k8scluster", "k8srepo", "pla")
+ topics = ("ns", "vim_account", "wim_account", "sdn", "nsi", "k8scluster", "vca", "k8srepo", "pla")
topics_admin = ("admin", )
await asyncio.gather(
self.msg.aioread(topics, self.loop, self.kafka_read_callback, from_beginning=True),
@@ -522,6 +533,7 @@
self.wim = vim_sdn.WimLcm(self.msg, self.lcm_tasks, self.config, self.loop)
self.sdn = vim_sdn.SdnLcm(self.msg, self.lcm_tasks, self.config, self.loop)
self.k8scluster = vim_sdn.K8sClusterLcm(self.msg, self.lcm_tasks, self.config, self.loop)
+ self.vca = vim_sdn.VcaLcm(self.msg, self.lcm_tasks, self.config, self.loop)
self.k8srepo = vim_sdn.K8sRepoLcm(self.msg, self.lcm_tasks, self.config, self.loop)
# configure tsdb prometheus