You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2012/10/12 14:15:51 UTC

[16/16] git commit: Update Nicira Api to support L3 functionality

Update Nicira Api to support L3 functionality

Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/bfc8da10
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/bfc8da10
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/bfc8da10

Branch: refs/heads/master
Commit: bfc8da1082ea3d27eec6d743d28b67ececdfd161
Parents: 5c4cf11
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Tue Sep 25 15:51:48 2012 -0700
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Tue Sep 25 15:51:48 2012 -0700

----------------------------------------------------------------------
 .../cloud/network/nicira/DestinationNatRule.java   |   53 ++++++
 .../cloud/network/nicira/L3GatewayAttachment.java  |   54 ++++++
 .../cloud/network/nicira/LogicalRouterConfig.java  |   64 +++++++
 .../cloud/network/nicira/LogicalRouterPort.java    |   90 ++++++++++
 .../src/com/cloud/network/nicira/Match.java        |  133 +++++++++++++++
 .../src/com/cloud/network/nicira/NatRule.java      |   24 +++
 .../src/com/cloud/network/nicira/NiciraNvpApi.java |   61 ++++++-
 .../com/cloud/network/nicira/RouterNextHop.java    |   34 ++++
 .../com/cloud/network/nicira/RoutingConfig.java    |    5 +
 .../SingleDefaultRouteImplictRoutingConfig.java    |   38 ++++
 .../com/cloud/network/nicira/SourceNatRule.java    |   79 +++++++++
 11 files changed, 630 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
new file mode 100644
index 0000000..2cbdace
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
@@ -0,0 +1,53 @@
+package com.cloud.network.nicira;
+
+public class DestinationNatRule extends NatRule {
+	private Match match;
+	private String to_destination_ip_address_min;
+	private String to_destination_ip_address_max;
+	private Integer to_destination_port;
+	private String uuid;
+	private String type = "DestinationNatRule";
+	
+	public Match getMatch() {
+		return match;
+	}
+	
+	public void setMatch(Match match) {
+		this.match = match;
+	}
+	
+	public String getToDestinationIpAddressMin() {
+		return to_destination_ip_address_min;
+	}
+	
+	public void setToDestinationIpAddressMin(
+			String to_destination_ip_address_min) {
+		this.to_destination_ip_address_min = to_destination_ip_address_min;
+	}
+	
+	public String getToDestinationIpAddressMax() {
+		return to_destination_ip_address_max;
+	}
+	
+	public void setToDestinationIpAddressMax(
+			String to_destination_ip_address_max) {
+		this.to_destination_ip_address_max = to_destination_ip_address_max;
+	}
+	
+	public Integer getToDestinationPort() {
+		return to_destination_port;
+	}
+	
+	public void setToDestinationPort(Integer to_destination_port) {
+		this.to_destination_port = to_destination_port;
+	}
+	
+	public String getUuid() {
+		return uuid;
+	}
+	
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
new file mode 100644
index 0000000..65a0a8e
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.nicira;
+
+/**
+ * 
+ */
+public class L3GatewayAttachment extends Attachment {
+	private String l3_gateway_service_uuid;
+	private String type = "L3GatewayAttachment";
+	private int vlan_id;
+	
+	public L3GatewayAttachment(String l3_gateway_service_uuid) {
+		this.l3_gateway_service_uuid = l3_gateway_service_uuid;
+		// VLAN 0 is untagged, set explicitly of no vlan is given in the constructor
+		this.vlan_id = 0;
+	}
+	
+	public L3GatewayAttachment(String l3_gateway_service_uuid, int vlan_id) {
+		this.l3_gateway_service_uuid = l3_gateway_service_uuid;
+		this.vlan_id = vlan_id;
+	}
+	
+	public String getL3GatewayServiceUuid() {
+		return l3_gateway_service_uuid;
+	}
+	
+	public void setL3GatewayServiceUuid(String l3_gateway_service_uuid) {
+		this.l3_gateway_service_uuid = l3_gateway_service_uuid;
+	}
+	
+	public int getVlanId() {
+		return vlan_id;
+	}
+	
+	public void setVlanId(int vlan_id) {
+		this.vlan_id = vlan_id;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
new file mode 100644
index 0000000..897ee06
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
@@ -0,0 +1,64 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.nicira;
+
+import java.util.List;
+
+/**
+ * 
+ */
+public class LogicalRouterConfig {
+	private String display_name;
+	private RoutingConfig routing_config;
+	private String type = "LogicalRouterConfig";
+	private String uuid;
+    private List<NiciraNvpTag> tags;
+	
+	public RoutingConfig getRoutingConfig() {
+		return routing_config;
+	}
+	
+	public void setRoutingConfig(RoutingConfig routing_config) {
+		this.routing_config = routing_config;
+	}
+	
+	public String getDisplayName() {
+		return display_name;
+	}
+	
+	public void setDisplayName(String display_name) {
+		this.display_name = display_name;
+	}
+	
+    public String getUuid() {
+        return uuid;
+    }
+    
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+    
+    public List<NiciraNvpTag> getTags() {
+        return tags;
+    }
+
+    public void setTags(List<NiciraNvpTag> tags) {
+        this.tags = tags;
+    }
+	
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
new file mode 100644
index 0000000..196106d
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.nicira;
+
+import java.util.List;
+
+/**
+ * 
+ */
+public class LogicalRouterPort {
+	private String display_name;
+	private List<NiciraNvpTag> tags;
+	private Integer portno;
+	private boolean admin_status_enabled;
+	private List<String> ip_addresses;
+	private String mac_address;
+	private String type = "LogicalRouterPortConfig";
+	private String uuid;
+	
+	public int getPortno() {
+		return portno;
+	}
+	
+	public void setPortno(int portno) {
+		this.portno = portno;
+	}
+	
+	public boolean isAdminStatusEnabled() {
+		return admin_status_enabled;
+	}
+	
+	public void setAdminStatusEnabled(boolean admin_status_enabled) {
+		this.admin_status_enabled = admin_status_enabled;
+	}
+	
+	public List<String> getIpAddresses() {
+		return ip_addresses;
+	}
+	
+	public void setIpAddresses(List<String> ip_addresses) {
+		this.ip_addresses = ip_addresses;
+	}
+	
+	public String getMacAddress() {
+		return mac_address;
+	}
+	
+	public void setMacAddress(String mac_address) {
+		this.mac_address = mac_address;
+	}
+	
+	public String getDisplayName() {
+		return display_name;
+	}
+
+	public void setDisplayName(String display_name) {
+		this.display_name = display_name;
+	}
+
+	public List<NiciraNvpTag> getTags() {
+		return tags;
+	}
+
+	public void setTags(List<NiciraNvpTag> tags) {
+		this.tags = tags;
+	}
+
+	public String getUuid() {
+		return uuid;
+	}
+
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
new file mode 100644
index 0000000..cd89847
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
@@ -0,0 +1,133 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.nicira;
+
+/**
+ * 
+ */
+public class Match {
+	private Integer protocol;
+	private String source_ip_addresses;
+	private boolean source_ip_addresses_not;
+	private String destination_ip_addresses;
+	private boolean destination_ip_addresses_not;
+	private Integer source_port_min;
+	private Integer source_port_max;
+	private boolean source_port_not;
+	private Integer destination_port_min;
+	private Integer destination_port_max;
+	private boolean destination_port_not;
+	private String ethertype = "IPv4";
+	
+	public Integer getProtocol() {
+		return protocol;
+	}
+	
+	public void setProtocol(Integer protocol) {
+		this.protocol = protocol;
+	}
+	
+	public Integer getSource_port_min() {
+		return source_port_min;
+	}
+	
+	public void setSourcePortMin(Integer source_port_min) {
+		this.source_port_min = source_port_min;
+	}
+	
+	public Integer getSourcePortMax() {
+		return source_port_max;
+	}
+	
+	public void setSourcePortMax(Integer source_port_max) {
+		this.source_port_max = source_port_max;
+	}
+	
+	public boolean isSourcePortNot() {
+		return source_port_not;
+	}
+
+	public void setSourcePortNot(boolean source_port_not) {
+		this.source_port_not = source_port_not;
+	}
+
+	public Integer getDestinationPortMin() {
+		return destination_port_min;
+	}
+	
+	public void setDestinationPortMin(Integer destination_port_min) {
+		this.destination_port_min = destination_port_min;
+	}
+	
+	public Integer getDestinationPortMax() {
+		return destination_port_max;
+	}
+	
+	public void setDestinationPortMax(Integer destination_port_max) {
+		this.destination_port_max = destination_port_max;
+	}
+	
+	public boolean isDestinationPortNot() {
+		return destination_port_not;
+	}
+
+	public void setDestinationPortNot(boolean destination_port_not) {
+		this.destination_port_not = destination_port_not;
+	}
+
+	public String getEthertype() {
+		return ethertype;
+	}
+	
+	public void setEthertype(String ethertype) {
+		this.ethertype = ethertype;
+	}
+
+	public String getSourceIpAddresses() {
+		return source_ip_addresses;
+	}
+
+	public void setSourceIpAddresses(String source_ip_addresses) {
+		this.source_ip_addresses = source_ip_addresses;
+	}
+
+	public boolean isSourceIpAddressesNot() {
+		return source_ip_addresses_not;
+	}
+
+	public void setSourceIpAddresses_not(boolean source_ip_addresses_not) {
+		this.source_ip_addresses_not = source_ip_addresses_not;
+	}
+
+	public String getDestinationIpAddresses() {
+		return destination_ip_addresses;
+	}
+
+	public void setDestinationIpAddresses(String destination_ip_addresses) {
+		this.destination_ip_addresses = destination_ip_addresses;
+	}
+
+	public boolean isDestinationIpAddressesNot() {
+		return destination_ip_addresses_not;
+	}
+
+	public void setDestinationIpAddressesNot(boolean destination_ip_addresses_not) {
+		this.destination_ip_addresses_not = destination_ip_addresses_not;
+	}
+	
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
new file mode 100644
index 0000000..30196f0
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
@@ -0,0 +1,24 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.nicira;
+
+/**
+ * 
+ */
+public abstract class NatRule {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
index 2c002ab..1c7b741 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
@@ -78,6 +78,7 @@ import com.google.gson.reflect.TypeToken;
 
 public class NiciraNvpApi {
     private static final Logger s_logger = Logger.getLogger(NiciraNvpApi.class);
+    private final static String _protocol = "https";
     
     private String _name;
     private String _host;
@@ -117,7 +118,7 @@ public class NiciraNvpApi {
         String url;
         
         try {
-            url = new URL("https", _host, "/ws.v1/login").toString();
+            url = new URL(_protocol, _host, "/ws.v1/login").toString();
         } catch (MalformedURLException e) {
             s_logger.error("Unable to build Nicira API URL", e);
             throw new NiciraNvpApiException("Unable to build Nicira API URL", e);
@@ -210,11 +211,61 @@ public class NiciraNvpApi {
         return lspl;
     }
     
+    public LogicalRouterConfig createLogicalRouter(LogicalRouterConfig logicalRouterConfig) throws NiciraNvpApiException {
+    	String uri = "/ws.v1/lrouter";
+    	
+    	LogicalRouterConfig lrc = executeCreateObject(logicalRouterConfig, new TypeToken<LogicalRouterConfig>(){}.getType(), uri, Collections.<String,String>emptyMap());
+    	
+    	return lrc;
+    }
+
+    public void deleteLogicalRouter(String logicalRouterUuid) throws NiciraNvpApiException {
+    	String uri = "/ws.v1/lrouter/" + logicalRouterUuid;
+    	
+    	executeDeleteObject(uri);
+    }
+    
+    public LogicalRouterPort createLogicalRouterPort(String logicalRouterUuid, LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException {
+    	String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport";
+    	
+    	LogicalRouterPort lrp = executeCreateObject(logicalRouterPort, new TypeToken<LogicalRouterPort>(){}.getType(), uri, Collections.<String,String>emptyMap());
+    	return lrp;    	
+    }
+    
+    public void deleteLogicalRouterPort(String logicalRouterUuid, String logicalRouterPortUuid) throws NiciraNvpApiException {
+    	String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport/" +  logicalRouterPortUuid;
+    	
+    	executeDeleteObject(uri);
+    }
+    
+    public void modifyLogicalRouterPortAttachment(String logicalRouterUuid, String logicalRouterPortUuid, Attachment attachment) throws NiciraNvpApiException {
+        String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport/" + logicalRouterPortUuid + "/attachment";
+        executeUpdateObject(attachment, uri, Collections.<String,String>emptyMap());
+    }
+    
+    public NatRule createLogicalRouterNatRule(String logicalRouterUuid, NatRule natRule) throws NiciraNvpApiException {
+    	String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat";
+    	
+    	if (natRule instanceof SourceNatRule) {
+    		return executeCreateObject(natRule, new TypeToken<SourceNatRule>(){}.getType(), uri, Collections.<String,String>emptyMap());
+    	}
+    	else if (natRule instanceof DestinationNatRule) {
+    		return executeCreateObject(natRule, new TypeToken<DestinationNatRule>(){}.getType(), uri, Collections.<String,String>emptyMap());
+    	}
+    	
+    	throw new NiciraNvpApiException("Unknown NatRule type");
+    }
+    
+    public void deleteLogicalRouterNatRule(String logicalRouterUuid, String natRuleUuid) throws NiciraNvpApiException {
+    	String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat/" + natRuleUuid;
+    	
+    	executeDeleteObject(uri);
+    }
     
     private <T> void executeUpdateObject(T newObject, String uri, Map<String,String> parameters) throws NiciraNvpApiException {
         String url;
         try {
-            url = new URL("https", _host, uri).toString();
+            url = new URL(_protocol, _host, uri).toString();
         } catch (MalformedURLException e) {
             s_logger.error("Unable to build Nicira API URL", e);
             throw new NiciraNvpApiException("Connection to NVP Failed");
@@ -244,7 +295,7 @@ public class NiciraNvpApi {
     private <T> T executeCreateObject(T newObject, Type returnObjectType, String uri, Map<String,String> parameters) throws NiciraNvpApiException {
         String url;
         try {
-            url = new URL("https", _host, uri).toString();
+            url = new URL(_protocol, _host, uri).toString();
         } catch (MalformedURLException e) {
             s_logger.error("Unable to build Nicira API URL", e);
             throw new NiciraNvpApiException("Unable to build Nicira API URL", e);
@@ -282,7 +333,7 @@ public class NiciraNvpApi {
     private void executeDeleteObject(String uri) throws NiciraNvpApiException {
         String url;
         try {
-            url = new URL("https", _host, uri).toString();
+            url = new URL(_protocol, _host, uri).toString();
         } catch (MalformedURLException e) {
             s_logger.error("Unable to build Nicira API URL", e);
             throw new NiciraNvpApiException("Unable to build Nicira API URL", e);
@@ -303,7 +354,7 @@ public class NiciraNvpApi {
     private <T> T executeRetrieveObject(Type returnObjectType, String uri, Map<String,String> parameters) throws NiciraNvpApiException {
         String url;
         try {
-            url = new URL("https", _host, uri).toString();
+            url = new URL(_protocol, _host, uri).toString();
         } catch (MalformedURLException e) {
             s_logger.error("Unable to build Nicira API URL", e);
             throw new NiciraNvpApiException("Unable to build Nicira API URL", e);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RouterNextHop.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RouterNextHop.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RouterNextHop.java
new file mode 100644
index 0000000..be302fa
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RouterNextHop.java
@@ -0,0 +1,34 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.nicira;
+
+/**
+ * 
+ */
+public class RouterNextHop {
+	private String gateway_ip_address;
+	private String type = "RouterNextHop";
+		
+	public String getGatewayIpAddress() {
+		return gateway_ip_address;
+	}
+	
+	public void setGatewayIpAddress(String gateway_ip_address) {
+		this.gateway_ip_address = gateway_ip_address;
+	}
+		
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RoutingConfig.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RoutingConfig.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RoutingConfig.java
new file mode 100644
index 0000000..12b3227
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RoutingConfig.java
@@ -0,0 +1,5 @@
+package com.cloud.network.nicira;
+
+public class RoutingConfig {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java
new file mode 100644
index 0000000..b4eda44
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.nicira;
+
+/**
+ * 
+ */
+public class SingleDefaultRouteImplictRoutingConfig extends RoutingConfig {
+	public RouterNextHop default_route_next_hop;
+	public String type = "SingleDefaultRouteImplicitRoutingConfig";
+	
+	public SingleDefaultRouteImplictRoutingConfig(RouterNextHop routerNextHop) {
+		default_route_next_hop = routerNextHop;
+	}
+	
+	public RouterNextHop getDefaultRouteNextHop() {
+		return default_route_next_hop;
+	}
+	
+	public void setDefaultRouteNextHop(RouterNextHop default_route_next_hop) {
+		this.default_route_next_hop = default_route_next_hop;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bfc8da10/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
new file mode 100644
index 0000000..7d1c13d
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
@@ -0,0 +1,79 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.nicira;
+
+/**
+ * 
+ */
+public class SourceNatRule extends NatRule {
+	private Match match;
+	private String to_source_ip_address_min;
+	private String to_source_ip_address_max;
+	private Integer to_source_port_min;
+	private Integer to_source_port_max;
+	private String uuid;
+	private String type = "SourceNatRule";
+	
+	public Match getMatch() {
+		return match;
+	}
+	
+	public void setMatch(Match match) {
+		this.match = match;
+	}
+	
+	public String getToSourceIpAddressMin() {
+		return to_source_ip_address_min;
+	}
+	
+	public void setToSourceIpAddressMin(String to_source_ip_address_min) {
+		this.to_source_ip_address_min = to_source_ip_address_min;
+	}
+	
+	public String getToSourceIpAddressMax() {
+		return to_source_ip_address_max;
+	}
+	
+	public void setToSourceIpAddressMax(String to_source_ip_address_max) {
+		this.to_source_ip_address_max = to_source_ip_address_max;
+	}
+	
+	public Integer getToSourcePortMin() {
+		return to_source_port_min;
+	}
+	
+	public void setToSourcePortMin(Integer to_source_port_min) {
+		this.to_source_port_min = to_source_port_min;
+	}
+	
+	public Integer getToSourcePortMax() {
+		return to_source_port_max;
+	}
+	
+	public void setToSourcePortMax(Integer to_source_port_max) {
+		this.to_source_port_max = to_source_port_max;
+	}
+	
+	public String getUuid() {
+		return uuid;
+	}
+	
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+	
+}