This module is a Virtualizer data model implementation example library in Python for the EU-FP7-UNIFY project.
The Virtualizer YANG model was presented in draft-unify-nfvrg-recursive-programming.
The main goal of the library was to provide a common interface between components from various partners, by realizing the Sl-Or UNIFY reference point according to the Virtualizer YANG model. Further expectations on the library were:
- Realize the elements of the Yang model by Python Objects
- Parse an entire Virtualizer instance from XML
- Dump an entire Virtualizer instance to XML
- Support main Netconf abstractions
- Support workflows, like: get config, edit config, diff config
- Support working with full configurations as well as partial updates to existing configurations
- Support easy access to components of an object (e.g. flow entries of a flow table)
- Support walking in the structure (e.g. from a port of a flow entry to the NF to which the port belongs to)
The library consists of two main files:
- virtualizer3.py: contains the Virtualizer object structure. This is autogenerated from the virtualizer3.yang module.
- baseclasses.py: contains the common components for the library, like the base Yang class for generic parsing, comparison, etc.
To install Virtualizer for development purposes, run:
$ sudo python setup.py develop
This will not actually install all the files in your system, but just link them to your development environment, simplifying the code/deploy/test cycle.
In order to install Virtualizer for demo/production purposes in a system-wide setup, run:
$ sudo python setup.py install
Alternatively, append the --user
flag to install it for just your user,
without root privileges being necessary.
A = Virtualizer()
: init an empty virtualizer objectB = Virtualizer.parse(xml)
: to parse an instance from an XML input (file or string)B.xml()
: to dump an instance to an XML string, e.g., for netconf operationB.reduce(A)
: remove all objects from B, which exist in A (create a canonical form)B.bind(A)
: resolve lefrefs; copy missing targets from A to B if neededA.merge(B)
: update A with changes from B; netconf operations are copied without executionC = A.diff(B)
: return a diff to go from A to BA.patch(C)
: apply C on A, i.e., A.patch(A.diff(B)) == B