Package: fabric_fim
Information ModelBasic Graph AbstractionsFABRIC Information Model library, containing class definitions and methods for operating
on different types of information model representations (sliver and slice).The implementation covers the following models and model transformations:ARM (Aggregate Resource Models) - generated by aggregate owner, may contain multiple resource delegations intended
for different brokersADM (Aggregate Delegation Model) - a single ARM may be partitioned into one or more ADMs intended for different
brokersCBM (Combined Broker Model) - multiple ADMs sent to a broker from different aggregates are merged into a single CBM.
If needed ADMs can be 'unmerged' from a CBM (when e.g. an aggregate goes off-line)BQM (Broker Query Model) - multiple types of BQMs can be produced by a broker in response tolistResources-like
queries from the information contained in CBM and live allocation information stored by the Broker.
The returned models can contain different levels of details of resources. BQMs can be used by user tools,
portals or other entities which need to inspect available testbed resourcesASM (Abstract Slice Mode) - model generated by user tools, passed to the Orchestrator, which describes a slice
topology. This model can be annotated by Orchestrator and Aggregate Managers with details of the provisioned (vs.
requested) infrastructure and returned back to the user. ASMs encompass what is commonly referred to as Slice Request
and Slice Manifest.These models are based on a common framework of Abstract Property Graph classfim.graph.abc_property_graph.py, which are
then subclassed into a NetworkX-based implementation and a Neo4j-based implementation of abstract functionalities.
Further types of models are built on top of these two implementations, thus allowing for easy interchange of the
underlying graph implementation - in-memory (via NetworkX) or persistent (via Neo4j).There is a generic graph validation framework built-in - validation is stronger/more thorough when operating on Neo4j
implementations due to stronger expressivity of Neo4j Cypher query language. Graph validation rules can be found underfim.graph.data.ARM, ADM, CBM definitions and implementations can be found underfim.graph.resources, ASM - underfim.graph.slices.
Abstract definitions of BQM are found underfim.graph.resources, however multiple subtypes of BQM (with different
levels of topology details presented to the requestor). Generation of different types of BQMs is done via broker plugins
intended to be external to FIM (perhaps inside the Control Framework). Seefim.pluggable.pyfor more details on
plugins.Higher-level AbstractionsOn top of basic property graph models described above, FIM offers additional more convenient abstractions that
interchangeably use the property graph implementations (NetworkX or Neo4j) underneath to allow for easier manipulation,
inspection of data.The main set of abstractions is implemented underfim.userpackage, which providesadditional documentation.Supporting intermediate models are implemented underfim.sliver, however these models are largely internal to FIM and
Control Framework, and generally are not exposed to end-users.Structure of the codeThis figure reflects the overall structure of the code:Follow this link intofim/README.mdto explore.Development environmentThe recommended way is to set up your development environment usingvirtualenvwrapperafter checking
out the code:$gitclonegit@github.com:fabric-testbed/InformationModel.git
$cdInformationModel
$mkvirtualenv-rrequirements.txtinfomodel
$workoninfomodel(infomodel)$You can also use the built-invenvtool that comes with newer versions of Python as follows:$ git clone git@github.com:fabric-testbed/InformationModel.git
$ cd InformationModel
$ python3 -m venv venv
$ source ./venv/bin/activate
$ pip install --upgrade pip setuptools
(venv) $Depending on which parts of FIM you are developing you may need to haveNeo4j-APOC docker containerrunning.
Working on any models whose names start withNeo4jgenerally requires using the Neo4j Docker.Models which start withNetworkXoperate on in-memory models using NetworkX toolkit and don't require the Neo4j Docker.
Higher-level abstractions underfim.usercan all be debugged and tested with in-memory NetworkX models, although they
operate on both types of models, depending on the situation.Follow the instructions with the container to start it.InstallationMultiple installation options possible. For CF development the recommended method is toinstall from GitHub MASTER branch:$pipinstallgit+https://github.com/fabric-testbed/InformationModel.gitFor developing and testing the FIM code itself use editable install (from top-level directory) and
install flit and pytest:(infomodel)$pipinstall-e.(infomodel)$pipinstallflit(infomodel)$pipinstallpytestFor inclusion in tools, etc, use PyPi$pipinstallfabric-fimCompatibility with Neo4jBelow is the compatibility matrix showing which major versions of FIM support which versions of Neo4j
(tested with the corresponding versions ofNeo4j-APOC docker container)FIM Major versionNeo4j-APOC docker version1.0-1.24.0.31.3-1.44.1.61.55.3.0Test GraphsOriginal Test GraphsOriginal test graphs are located undertests/models. All graphs were created usingyEddesktop graph editor (note that on-line version does not provide the same flexibility for creating custom node
and link properties).Generating New Test GraphsDepending on the type of graph, many test graphs can be generated using higher-level abstraction libraries.For example ASMs can be generated starting fromfim.user.topology.ExperimentTopologyobject, while ARMs can be
generated usingfim.user.topology.SubstrateTopology. Other models are generally derived from these types of models,
as described in the overview.Test graphs are generated by unit tests:ASMs are generated intest/slice_topology_test.pyARMs are generated intest/substrate_topology_test.pyARM-ADM-CBM operations are tested intest/zz_neo4j_pg_test.pybased on serializations produced intest/substrate_topology_test.py.Testing and buildingIn order to run tests, you will need to usepytest.
Also, in order to support tests of Neo4j-implemented models, Neo4j-APOC should be running in a Docker container:$dockerrun-p7474:7474-p7687:7687-eNEO4J_AUTH=neo4j/password\-v$(pwd)/neo4j/data:/data-v$(pwd)/neo4j/imports:/imports\fabrictestbed/neo4j-apocNote that the directoriesneo4j/dataandneo4j/importsmust exist for the above command to work as expected.Wait for neo4j-apoc Docker container to start up, and then run pytest:$pytest[-s]testThis will produce substrate ARM models and save them into file in project root folder.To build and publish run$flitbuild$flitpublishor just (assuming your .pypirc is setup with the token to access PyPi)$flitpublishGraph validationAll graphs loaded into Neo4j (whether from files or being passed in as part of query or delegation)
must conform to a set of rules expressed as Cypher queries. The basic set of rules for all
types of graphs are located infim/graph/graph_validation_rules.json.Prior to ingestion graphs are also tested on general syntax validity of JSON-formatted fields.Additional rule files specific to model types may govern the validity of specific models.NetworkX-based graphs also undergo validation, but more limited in scope due to lack of tools.Using fim_util utilityThe utility supports a number of operations on GraphML files - enumerating nodes (for graphs)
coming out of yEd, loading into an instance of Neo4j, deleting graphs from Neo4j.Start the appropriate version ofNeo4j-APOC docker containerCreate fim_config.yaml with the following structure underutil/:# default fim_config configuration file for FIM utilities
neo4j:
  url: neo4j://0.0.0.0:7687
  user: neo4j
  pass: password
  import_host_dir: /host/directory/seen/by/neo4j/docker/as/imports
  import_dir: /importsParameterspasswordandimport_host_dirdepend on how the Docker container is started in
the procedure above. Other parameters should remain unchanged from what is shown.Run the utility for detailed help for the various operations:(infomodel) $ fim_util -hGenerally the utility is good for e.g. loading a graph file:fim_util -l -f -r <graphml file>or
merging multiple advertisements:fim_util -m -f <file1> -f <file2>. Most options take multiple-fand related options so can e.g. load multiple files at once.When testing large graphs, note that by default Neo4j visualizes the first 300 nodes in a browser. If you
want to see a full graph, increase this limit (at neo4j prompt)::config initialNodeDisplay: 5000Neo4j Performance ConsiderationsFor performance reasons it is critical that every instance of Neo4j has appropriate indexes created.
Neo4j labelGraphNodeis hard-coded within FIM - every graph node has this label and another label is created
from the Class property and is meaningful to FIM.
This is done for performance reasons to make it easier to create indexes and query models using those indexes.The following indexes are required (indexes are created automatically by Neo4jGraphImporter whenever it is used):CREATE INDEX graphid FOR (n:GraphNode) ON (n.GraphID)
CREATE INDEX graphid_nodeid FOR (n:GraphNode) ON (n.GraphID, n.NodeID)
CREATE INDEX graphid_nodeid_type FOR (n:GraphNode) ON (n.GraphID, n.NodeID, n.Type)
CREATE INDEX graphid_type FOR (n:GraphNode) ON (n.GraphID, n.Type)Available indexes can be checked via console by using the:schemacommand.An index can be dropped using the following command (substitute appropriate index name):DROP INDEX graphidSeeadditional documentation.