CIMI Networking in Deltacloud - A Work in Progress

I’m currently implementing the CIMI Network entities for Deltacloud - this post introduces these and shows some examples of how a client can use Deltacloud to interact with a CIMI server, using the CIMI REST API.

The DMTF Cloud Infrastructure Management Interface (CIMI) is still a work-in-progress. As far as I am aware, Deltacloud is currently the only project offering an implementation of the CIMI REST API. Since CIMI itself is still a work-in-progress, it naturally follows that its implementation in Deltacloud is also a work-in-progress. Thats all just a round about way of saying the following is very likely to change before CIMI v1.0 ships later this year (likely late Q2 or early Q3 2012) - though hopefully not too much.


Implemented network entities and the Deltacloud mock driver

The currently implemented entities are:

  • Network,NetworkTemplate, NetworkConfiguration (+collections)
  • VSP, VSPTemplate, VSPConfiguration (+collections)
  • RoutingGroup, RoutingGroupTemplate (+collections)
  • Address, AddressTemplate (+collections)

The simple ‘GET’ and operation is implemented for all of these - however creation/deletion is currently only supported by Network, VSP and Address.

Since there aren’t any cloud providers out there that offer a CIMI API - the Deltacloud server is actually using the ‘mock’ driver to simulate a CIMI cloud provider. The mock driver pretends to be a cloud in a way that is transparent to consumers (‘client’ in CIMI); that is a consumer interacts with the mock driver in the same way as they would interact with a ‘real’ CIMI cloud provider. This allows us to implement and test the CIMI API until the ‘real’ implementations arrive.

For the mock driver, each ‘entity’ is actually a ‘json’ file on disk. json was an arbitrary choice - we could have used xml, or even yaml as is used for the Deltacloud API entities. To start the deltacloud server, exposing the CIMI API and talking to the ‘mock’ cloud provider:

deltacloudd --cimi -i mock

This will start the deltacloud server on localhost port 3001. There is more information about getting Deltacloud and running it on the project website. Please [get in touch] (http://deltacloud.apache.org/contact.html) if you need any help getting started.

index


Operation examples with cURL

Getting the Cloud Entry Point

[marios@name ~]$ curl --user "mockuser:mockpassword"
                 http://localhost:3001/cimi/cloudEntryPoint?format=xml

<CloudEntryPoint xmlns="http://www.dmtf.org/cimi">
  <volumeImages href="http://localhost:3001/cimi/volume_images" />
  <entityMetadata></entityMetadata>
  <addressTemplates href="http://localhost:3001/cimi/address_templates" />
  <vspConfigurations href="http://localhost:3001/cimi/vsp_configurations" />
  <routingGroupTemplates href="http://localhost:3001/cimi/routing_group_templates" />
  <id>http://localhost:3001/cimi/cloudEntryPoint</id>
  <networkTemplates href="http://localhost:3001/cimi/network_templates" />
  <machines href="http://localhost:3001/cimi/machines" />
  <addresses href="http://localhost:3001/cimi/addresses" />
  <networks href="http://localhost:3001/cimi/networks" />
  <volumeConfigurations href="http://localhost:3001/cimi/volume_configurations" />
  <machineAdmins href="http://localhost:3001/cimi/machine_admins" />
  <volumes href="http://localhost:3001/cimi/volumes" />
  <created>Fri Apr 06 16:59:18 +0300 2012</created>
  <vsps href="http://localhost:3001/cimi/vsps" />
  <routingGroups href="http://localhost:3001/cimi/routing_groups" />
  <networkConfigurations href="http://localhost:3001/cimi/network_configurations" />
  <machineConfigurations href="http://localhost:3001/cimi/machine_configurations" />
  <machineImages href="http://localhost:3001/cimi/machine_images" />
  <name>mock</name>
  <vspTemplates href="http://localhost:3001/cimi/vsp_templates" />
  <description>Cloud Entry Point for the Deltacloud mock driver</description>
</CloudEntryPoint>

index


Getting the NetworkCollection

[marios@name ~]$ curl --user "mockuser:mockpassword"
                 http://localhost:3001/cimi/networks?format=xml

<NetworkCollection xmlns="http://www.dmtf.org/cimi">
  <id>http://localhost:3001/cimi/networks</id>
  <created>Fri Apr 06 17:08:40 +0300 2012</created>
  <network href="http://localhost:3001/cimi/networks/network1" />
  <network href="http://localhost:3001/cimi/networks/network2" />
  <name>default</name>
  <description>Mock NetworkCollection</description>
</NetworkCollection>

index


Getting a specific VSP

[marios@name ~]$ curl --user "mockuser:mockpassword"
            http://localhost:3001/cimi/vsps/vsp1?format=xml

<VSP xmlns="http://www.dmtf.org/cimi">
  <state>STARTED</state>
  <maxTrafficLoss>100</maxTrafficLoss>
  <id>http://localhost:3001/cimi/vsps/vsp1</id>
  <maxTrafficJitter>100000</maxTrafficJitter>
  <operation href="http://localhost:3001/cimi/vsps/vsp1" rel="edit" />
  <operation href="http://localhost:3001/cimi/vsps/vsp1" rel="delete" />
  <maxTrafficDelay>500000</maxTrafficDelay>
  <created>Fri Mar 16 17:06:41 EET 2012</created>
  <trafficPriority>1</trafficPriority>
  <network href="http://localhost:3001/cimi/networks/network1" />
  <name>vsp1</name>
  <bandwidthReservation>0.5</bandwidthReservation>
  <description>a mock switchport</description>
</VSP>

index


Create/Delete Networks

Deleting a Network is the easiest case so we deal with that first. To delete a Network called “my_test_network”:

curl -X DELETE --user "mockuser:mockpassword" http://localhost:3001/cimi/networks/my_test_network?format=xml

There are 3 ways to create a network, with respect to the NetworkTemplate used. A consumer can i) specify a NetworkTemplate by reference, ii) specify NetworkTemplate by value, but with a NetworkConfig by reference, iii) specify a NetworkTemplate by value, with a NetworkConfig by value:

Create a Network, specifying a NetworkTemplate by reference:

XML:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/CIMI-NetworkCreate+xml"
-d '<NetworkCreate>
      <name> my_test_network </name>
      <description> A test network </description>
      <networkTemplate href="http://localhost:3001/cimi/network_templates/template1">
      </networkTemplate>
    </NetworkCreate>' http://localhost:3001/cimi/networks

JSON:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/CIMI-NetworkCreate+json"
-d '{ "name": "my_test_network", "description": "a foo network",
      "networkTemplate": {
        "href": "http://localhost:3001/cimi/network_templates/template1"}}'
http://localhost:3001/cimi/networks
Create a Network with NetworkTemplate by value and NetworkConfiguration by reference:

XML:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/CIMI-NetworkCreate+xml"
-d '<NetworkCreate>
      <name> my_test_network </name>
      <description> A test network </description>
      <networkTemplate>
        <networkConfig href="http://localhost:3001/cimi/network_configurations/network_config1">
        </networkConfig>
        <routingGroup href="http://localhost:3001/cimi/routing_groups/group1">
        </routingGroup>
      </networkTemplate>
    </NetworkCreate>' http://localhost:3001/cimi/networks

JSON:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/CIMI-NetworkCreate+json"
-d '{ "name": "my_test_network", "description": "a foo network",
      "networkTemplate": {
        "networkConfig":{
          "href": "http://localhost:3001/cimi/network_configurations/network_config1"},
        "routingGroup": {
          "href": "http://localhost:3001/cimi/routing_groups/group1"}}}'
http://localhost:3001/cimi/networks?format=json
Create a Network with NetworkTemplate by value and NetworkConfiguration by value:

XML:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/CIMI-NetworkCreate+xml"
-d '<NetworkCreate>
      <name> my_test_network </name>
      <description> A test network </description>
      <networkTemplate>
        <networkConfig>
          <access> public </access>
          <bandwidthLimit> 2 </bandwidthLimit>
          <trafficPriority> 1 </trafficPriority>
          <maxTrafficDelay> 500000 </maxTrafficDelay>
          <maxTrafficLoss> 100 </maxTrafficLoss>
          <maxTrafficJitter> 100000 </maxTrafficJitter>
        </networkConfig>
        <routingGroup href="http://localhost:3001/cimi/routing_groups/group1">
        </routingGroup>
      </networkTemplate> </NetworkCreate>'
http://localhost:3001/cimi/networks?format=xml

JSON:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/CIMI-NetworkCreate+json"
-d '{ "name": "my_test_network", "description": "a foo network",
    "networkTemplate": {
      "networkConfig": {
        "access": "public", "bandwidthLimit": 2, "trafficPriority": 1,
        "maxTrafficDelay": 500000, "maxTrafficLoss": 100, "maxTrafficJitter": 100000},
      "routingGroup": {
        "href": "http://localhost:3001/cimi/routing_groups/group1" } } }'
http://localhost:3001/cimi/networks?format=json

In all cases, the consumer gets a representation of the newly created Network - either in json or xml format as specified by the “?format=” parameter of the url (http://localhost:3001/cimi/networks?format=xml):

<Network xmlns="http://www.dmtf.org/cimi">
  <state>STARTED</state>
  <maxTrafficLoss>100</maxTrafficLoss>
  <id>http://localhost:3001/cimi/networks/my_test_network </id>
  <routingGroup href="http://localhost:3001/cimi/routing_groups/group1" />
  <maxTrafficJitter>100000</maxTrafficJitter>
  <operation href="http://localhost:3001/cimi/networks/my_test_network" rel="edit" />
  <operation href="http://localhost:3001/cimi/networks/my_test_network" rel="delete" />
  <maxTrafficDelay>500000</maxTrafficDelay>
  <access>Public</access>
  <created>Fri Apr 06 17:15:20 +0300 2012</created>
  <trafficPriority>1</trafficPriority>
  <name> my_test_network </name>
  <description> A test network </description>
</Network>

index


Network state change

Networks respond to start, stop and suspend actions. In CIMI, an ‘Action’ entity is used to effect state changes. Below I show only the ‘stop’ example as the others are very similar (using ‘start’ and ‘suspend’ actions to the Network start/suspend URL respectively).

XML:

curl -iv -X POST --user "mockuser:mockpassword" -H "Content-Type: application/xml"
-d '<Action xmlns="http://www.dmtf.org/cimi">
      <action> http://www.dmtf.org/cimi/action/stop </action>
    </Action> ' http://localhost:3001/cimi/networks/my_test_network/stop?format=xml

JSON:

curl -iv -X POST --user "mockuser:mockpassword" -H "Content-Type: application/json"
-d '{"entityURI": "http://www.dmtf.org/cimi/Action",
    "action":"http://www.dmtf.org/cimi/action/stop"}'
http://localhost:3001/cimi/networks/my_test_network/stop?format=json

index


Create/Delete Address

Again, the delete operation is the simplest:

curl -X DELETE --user "mockuser:mockpassword"
http://localhost:3001/cimi/addresses/address1?format=xml

To create an Address, a consumer can either pass an AddressTemplate by value (inline) or by reference:

Create Address using AddressTemplate by value

XML:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/xml"
-d '<AddressCreate>
      <name> an_address </name>
      <description> an IP Address </description>
      <addressTemplate>
        <ip> 192.168.10.100 </ip>
        <hostname> marios.local </hostname>
        <allocation> static </allocation>
        <defaultGateway> 192.168.0.1 </defaultGateway>
        <dns> 192.168.0.10 </dns>
        <macAddress></macAddress>
        <protocol> IPv4 </protocol>
        <mask> 255.255.0.0 </mask>
        <network href="http://localhost:3001/cimi/networks/network1">
        </network>
      </addressTemplate>
    </AddressCreate>' http://localhost:3001/cimi/addresses?format=xml

JSON:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/json"
-d '{ "name": "an_address", "description": "an IP Address",
"addressTemplate": {
  "ip": "192.168.10.100", "hostname": "marios.local",
  "allocation": "static", "defaultGateway": "192.168.0.1",
  "dns": "192.168.0.10","macAddress": "",
  "protocol": "IPv4", "mask": "255.255.0.0",
  "network": {"href": "http://localhost:3001/cimi/networks/network1" }}}'
http://localhost:3001/cimi/addresses?format=json
Create Address using AddressTemplate by reference:

XML:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/xml"
-d '<AddressCreate>
      <name> an_address </name>
      <description> an IP Address </description>
      <addressTemplate href="http://localhost:3001/cimi/address_templates/addr_template1">
      </addressTemplate>
    </AddressCreate>' http://localhost:3001/cimi/addresses?format=xml

JSON:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/json"
-d '{ "name": "an_address", "description": "an IP Address",
"addressTemplate": {
  "href": "http://localhost:3001/cimi/address_templates/addr_template1"}}'
http://localhost:3001/cimi/addresses?format=json

index


Create/Delete VSP

To delete a VSP:

curl -X DELETE --user "mockuser:mockpassword" http://localhost:3001/cimi/vsps/vsp1

As with Networks, there are 3 ways to create a vsp: i) With a VSPTemplate by value, using a VSPConfiguration by value, ii) with a VSPTemplate by value and a VSPConfiguration by reference, iii) with a VSPTemplate by reference:

VSPTemplate by value, with a VSPConfiguration by value

XML:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/xml"
-d '<VSPCreate>
      <name> my_vsp </name> <description> a Virtual Switch Port </description>
      <vspTemplate>
        <vspConfig>
          <bandwidthReservation> 0.5 </bandwidthReservation>
          <trafficPriority> 1 </trafficPriority>
          <maxTrafficDelay> 500000 </maxTrafficDelay>
          <maxTrafficLoss> 100 </maxTrafficLoss>
          <maxTrafficJitter> 100000 </maxTrafficJitter>
        </vspConfig>
        <network href="http://localhost:3001/cimi/networks/network1">
        </network>
      </vspTemplate>
    </VSPCreate>' http://localhost:3001/cimi/vsps?format=xml

JSON:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/json"
-d '{ "name": "my_vsp", "description": "a Virtual Switch Port",
"vspTemplate": {
  "vspConfig": {
    "bandwidthReservation": 0.5, "trafficPriority": 1, "maxTrafficDelay": 500000,
    "maxTrafficLoss": 100, "maxTrafficJitter": 100000},
  "network": {"href": "http://localhost:3001/cimi/networks/network1" }}}'
http://localhost:3001/cimi/vsps?format=json
VSPTemplate by value, with a VSPConfiguration by reference

XML:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/xml"
-d '<VSPCreate>
      <name> my_vsp </name>
      <description> a Virtual Switch Port </description>
      <vspTemplate>
        <vspConfig href="http://localhost:3001/cimi/vsp_configurations/vspconfig1">
        </vspConfig>
        <network href="http://localhost:3001/cimi/networks/network1"> </network>
      </vspTemplate>
    </VSPCreate>' http://localhost:3001/cimi/vsps?format=xml

JSON:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/json"
-d '{ "name": "my_vsp", "description": "a Virtual Switch Port",
"vspTemplate": {
  "vspConfig": {"href": "http://localhost:3001/cimi/vsp_configurations/vspconfig1"},
  "network": {"href": "http://localhost:3001/cimi/networks/network1" }}}'
http://localhost:3001/cimi/vsps?format=json
VSPTemplate by reference

XML:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/xml"
-d '<VSPCreate>
      <name> my_vsp </name>
      <description> a Virtual Switch Port </description>
      <vspTemplate href="http://localhost:3001/cimi/vsp_templates/template1">
      </vspTemplate>
    </VSPCreate>' http://localhost:3001/cimi/vsps?format=xml

JSON:

curl -X POST --user "mockuser:mockpassword" -H "Content-Type: application/json"
-d '{ "name": "my_vsp", "description": "a Virtual Switch Port",
"vspTemplate": {
  "href": "http://localhost:3001/cimi/vsp_templates/template1"}}'
http://localhost:3001/cimi/vsps?format=json

index


VSP state change

VSPs respond to start and stop actions. In CIMI, an ‘Action’ entity is used to effect state changes. Below I show only the ‘stop’ example as start is very similar (using a ‘start’ action to the Network start URL instead).

XML:

curl -iv -X POST --user "mockuser:mockpassword" -H "Content-Type: application/xml"
-d '<Action xmlns="http://www.dmtf.org/cimi">
      <action> http://www.dmtf.org/cimi/action/stop </action>
    </Action>' http://localhost:3001/cimi/vsps/my_vsp/stop?format=xml

JSON:

curl -iv -X POST --user "mockuser:mockpassword" -H "Content-Type: application/json"
-d '{"entityURI": "http://www.dmtf.org/cimi/Action",
      "action":"http://www.dmtf.org/cimi/action/stop"}'
http://localhost:3001/cimi/vsps/my_vsp/stop?format=json

index




blog comments powered by Disqus
RSS Feed Icon site.xml
RSS Feed Icon tripleo.xml