From: Adam Israel Date: Thu, 3 May 2018 18:49:56 +0000 (-0400) Subject: Documentation update X-Git-Tag: v4.0.0~2 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=commitdiff_plain;h=c9df96f0699cb656166a696219749646f12052d1 Documentation update - Updates of the pydoc and README.md - Rebase Signed-off-by: Adam Israel Change-Id: I9da9c2fd4432af00f7c655ce4789ce6dac629bc9 --- diff --git a/README.md b/README.md index a4cfb9d..7f65584 100644 --- a/README.md +++ b/README.md @@ -38,38 +38,14 @@ snap install lxd snap install juju --classic ``` -### Install the IM +## Metrics -The pyangbind library, used by the IM to parse the Yang data models does not support Python3 at the moment. Work is being done in coordination with the pyangbind maintainer, and Python3 support is expected to hand in the near future. +### Limitations -In the meantime, we will install and use Python3-compatible branches of pyangbind and the IM module. +There are currently a few limitations with regard to metrics in Juju. +1. Metrics are polled by the Controller every five minutes. This interval is not modifiable +2. The Juju API and CLI only expose the most recently polled metric, so it's necessary to poll the N2VC `GetMetrics` method more often, and discard duplicate values. -``` -sudo apt install libxml2-dev libxslt1-dev build-essential - -git clone http://github.com/adamisrael/pyangbind.git -cd pyangbind -pip3 install -r requirements.txt -pip3 install -r requirements.DEVELOPER.txt - -sudo python3 setup.py develop -``` - -Checkout the IM module and use the proposed branch from Gerrit: -```bash -git clone https://osm.etsi.org/gerrit/osm/IM.git -cd IM -git fetch https://israelad@osm.etsi.org/gerrit/osm/IM refs/changes/78/5778/2 && git checkout FETCH_HEAD -sudo python3 setup.py develop -``` - -```bash -git clone https://osm.etsi.org/gerrit/osm/N2VC.git -cd N2VC -git fetch https://israelad@osm.etsi.org/gerrit/osm/N2VC refs/changes/70/5870/5 && git checkout FETCH_HEAD -sudo python3 setup.py develop - -``` ## Testing A basic test has been written to exercise the functionality of the library, and to serve as a demonstration of how to use it. @@ -99,7 +75,6 @@ nosetests3 --nocapture tests/test_python.py Many. This is still in active development for Release FOUR. -- `GetMetrics` does not work yet. There seems to be - An exception is thrown after using N2VC, probably related to the internal AllWatcher used by juju.Model. This shouldn't break usage of N2VC, but it is ugly and needs to be fixed. ``` diff --git a/n2vc/vnf.py b/n2vc/vnf.py index 9641e73..e39b04e 100644 --- a/n2vc/vnf.py +++ b/n2vc/vnf.py @@ -246,10 +246,7 @@ class N2VC: Deploy the charm(s) referenced in a VNF Descriptor. - You can pass either the nsd record or the id of the network - service, but this method will fail without one of them. - - :param str ns_name: The name of the network service + :param str model_name: The name of the network service. :param str application_name: The name of the application :param dict vnfd: The name of the application :param str charm_path: The path to the Juju charm @@ -400,10 +397,22 @@ class N2VC: raise async def ExecutePrimitive(self, model_name, application_name, primitive, callback, *callback_args, **params): - """ - Queue the execution of a primitive + """Execute a primitive of a charm for Day 1 or Day 2 configuration. + + Execute a primitive defined in the VNF descriptor. - returns the UUID of the executed primitive + :param str model_name: The name of the network service. + :param str application_name: The name of the application + :param str primitive: The name of the primitive to execute. + :param obj callback: A callback function to receive status changes. + :param tuple callback_args: A list of arguments to be passed to the callback function. + :param dict params: A dictionary of key=value pairs representing the primitive's parameters + Examples:: + { + 'rw_mgmt_ip': '1.2.3.4', + # Pass the initial-config-primitives section of the vnf or vdu + 'initial-config-primitives': {...} + } """ uuid = None try: @@ -436,6 +445,15 @@ class N2VC: return uuid async def RemoveCharms(self, model_name, application_name, callback=None, *callback_args): + """Remove a charm from the VCA. + + Remove a charm referenced in a VNF Descriptor. + + :param str model_name: The name of the network service. + :param str application_name: The name of the application + :param obj callback: A callback function to receive status changes. + :param tuple callback_args: A list of arguments to be passed to the callback function. + """ try: if not self.authenticated: await self.login()