Juniper/contrail-dev-generateDS

Name: contrail-dev-generateDS

Owner: Juniper Networks

Description: Contrail development repo (forked from Juniper/contrail-generateDS)

Created: 2014-05-07 21:39:13.0

Updated: 2014-06-04 00:41:11.0

Pushed: 2014-06-04 00:41:11.0

Homepage: null

Size: 654

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

contrail-generateDS

Contrail XML schema code generator

The contrail XSD generator reads .xsd files containing IF-MAP identities, links and properties and generates python, c++ and java code used by different modules of the Contrail Virtual Network Controller.

The IDL syntax is the following:

 #IFMAP-SEMANTICS-IDL list-of-statements
 list-of-statements := list-of-statements, statement
 statement  := Link('element', 'identifier', 'identifier', [ref-type-list])|
               Type('element', [type-list])|
               Property(element-name identifier-name)|
               Exclude('element', [generator-list])
 element    := metadata element name
 identifier := identifier element name | "any" | "all"
 ref-type-list:= ref-type-list 'has' |
              := ref-type-list 'ref' |
              := 
 ref-type-list:= ref-type-list 'string-enum' |
              := 
 string-enum  := This command will convert string type restriction to 
               enum type
 generator-list:= generator-list 'backend'|
               := generator-list 'frontend'|
               := 

example:

:element name="virtual-machine" type="ifmap:IdentityType"/>
:element name="virtual-machine-interface" type="ifmap:IdentityType"/>

:element name="virtual-machine-virtual-machine-interface"/>
#IFMAP-SEMANTICS-IDL 
 Link('virtual-machine-virtual-machine-interface',
      'virtual-machine', 'virtual-machine-interface', ['has']) -->

:complexType name='VirtualMachineInterfacePropertiesType'>
<xsd:all>
    <xsd:element name='service-interface-type' type="ServiceInterfaceType"/>
    <xsd:element name='interface-mirror'  type="InterfaceMirrorType"/>
</xsd:all>
d:complexType>

:element name="virtual-machine-interface-properties" 
         type="VirtualMachineInterfacePropertiesType"/>
#IFMAP-SEMANTICS-IDL 
 Property('virtual-machine-interface-properties',
         'virtual-machine-interface') -->

The XSD snippet above defines two IFMAP identifiers (virtual-machine and virtual-machine-interface) and the associated metadata (link between virtual-machine and its interface) as well as properties that can be associated with the identifiers.

The implementation is using generateDS as an XSD parser and to help it create an intermediate model; this intermediate model is implemented by type_model.py and ifmap_model.py; different backends then generate code for different software modules.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.