http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/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 index 897ee06..088cefc 100644 --- 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 @@ -5,7 +5,7 @@ // 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, @@ -19,39 +19,39 @@ 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 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 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; } @@ -59,6 +59,5 @@ public class LogicalRouterConfig { public void setTags(List<NiciraNvpTag> tags) { this.tags = tags; } - - + }
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/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 index 196106d..112825d 100644 --- 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 @@ -5,7 +5,7 @@ // 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, @@ -19,72 +19,72 @@ 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; - } + 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/cloudstack/blob/256763cf/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java index f565189..f022ff7 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java @@ -29,51 +29,51 @@ public class LogicalSwitch { //private RequestQueryParameters _query; //private LogicalSwitchRelations _relations; private String _schema; - + public String getDisplay_name() { return display_name; } - + public void setDisplay_name(String display_name) { this.display_name = display_name; } - + public boolean isPort_isolation_enabled() { return port_isolation_enabled; } - + public void setPort_isolation_enabled(boolean port_isolation_enabled) { this.port_isolation_enabled = port_isolation_enabled; } - + public String getType() { return type; } - + public void setType(String type) { this.type = type; } - + public String getUuid() { return uuid; } - + public void setUuid(String uuid) { this.uuid = uuid; } - + public String get_href() { return _href; } - + public void set_href(String _href) { this._href = _href; } - + public String get_schema() { return _schema; } - + public void set_schema(String _schema) { this._schema = _schema; } @@ -93,6 +93,6 @@ public class LogicalSwitch { public void setTransport_zones(List<TransportZoneBinding> transport_zones) { this.transport_zones = transport_zones; } - - + + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java index c571458..aaf5494 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java @@ -29,7 +29,7 @@ public class LogicalSwitchPort { private List<String> mirror_targets; private String type; private String uuid; - + public LogicalSwitchPort() { super(); } @@ -113,5 +113,5 @@ public class LogicalSwitchPort { public void setUuid(String uuid) { this.uuid = uuid; } - + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/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 index f777782..e437344 100644 --- 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 @@ -5,7 +5,7 @@ // 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, @@ -17,131 +17,117 @@ package com.cloud.network.nicira; /** - * + * */ public class Match { - private Integer protocol; - private String source_ip_addresses; - private String destination_ip_addresses; - private Integer source_port; - private Integer destination_port; - private String ethertype = "IPv4"; - - public Integer getProtocol() { - return protocol; - } - - public void setProtocol(Integer protocol) { - this.protocol = protocol; - } - - public Integer getSourcePort() { - return source_port; - } - - public void setSourcePort(Integer source_port) { - this.source_port = source_port; - } - - public Integer getDestinationPort() { - return destination_port; - } - - public void setDestinationPort(Integer destination_port) { - this.destination_port = destination_port; - } - - 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 String getDestinationIpAddresses() { - return destination_ip_addresses; - } - - public void setDestinationIpAddresses(String destination_ip_addresses) { - this.destination_ip_addresses = destination_ip_addresses; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime - * result - + ((destination_ip_addresses == null) ? 0 - : destination_ip_addresses.hashCode()); - result = prime - * result - + ((destination_port == null) ? 0 : destination_port - .hashCode()); - result = prime * result - + ((ethertype == null) ? 0 : ethertype.hashCode()); - result = prime * result - + ((protocol == null) ? 0 : protocol.hashCode()); - result = prime - * result - + ((source_ip_addresses == null) ? 0 : source_ip_addresses - .hashCode()); - result = prime * result - + ((source_port == null) ? 0 : source_port.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Match other = (Match) obj; - if (destination_ip_addresses == null) { - if (other.destination_ip_addresses != null) - return false; - } else if (!destination_ip_addresses - .equals(other.destination_ip_addresses)) - return false; - if (destination_port == null) { - if (other.destination_port != null) - return false; - } else if (!destination_port.equals(other.destination_port)) - return false; - if (ethertype == null) { - if (other.ethertype != null) - return false; - } else if (!ethertype.equals(other.ethertype)) - return false; - if (protocol == null) { - if (other.protocol != null) - return false; - } else if (!protocol.equals(other.protocol)) - return false; - if (source_ip_addresses == null) { - if (other.source_ip_addresses != null) - return false; - } else if (!source_ip_addresses.equals(other.source_ip_addresses)) - return false; - if (source_port == null) { - if (other.source_port != null) - return false; - } else if (!source_port.equals(other.source_port)) - return false; - return true; - } - - + private Integer protocol; + private String source_ip_addresses; + private String destination_ip_addresses; + private Integer source_port; + private Integer destination_port; + private String ethertype = "IPv4"; + + public Integer getProtocol() { + return protocol; + } + + public void setProtocol(Integer protocol) { + this.protocol = protocol; + } + + public Integer getSourcePort() { + return source_port; + } + + public void setSourcePort(Integer source_port) { + this.source_port = source_port; + } + + public Integer getDestinationPort() { + return destination_port; + } + + public void setDestinationPort(Integer destination_port) { + this.destination_port = destination_port; + } + + 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 String getDestinationIpAddresses() { + return destination_ip_addresses; + } + + public void setDestinationIpAddresses(String destination_ip_addresses) { + this.destination_ip_addresses = destination_ip_addresses; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((destination_ip_addresses == null) ? 0 : destination_ip_addresses.hashCode()); + result = prime * result + ((destination_port == null) ? 0 : destination_port.hashCode()); + result = prime * result + ((ethertype == null) ? 0 : ethertype.hashCode()); + result = prime * result + ((protocol == null) ? 0 : protocol.hashCode()); + result = prime * result + ((source_ip_addresses == null) ? 0 : source_ip_addresses.hashCode()); + result = prime * result + ((source_port == null) ? 0 : source_port.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Match other = (Match) obj; + if (destination_ip_addresses == null) { + if (other.destination_ip_addresses != null) + return false; + } else if (!destination_ip_addresses.equals(other.destination_ip_addresses)) + return false; + if (destination_port == null) { + if (other.destination_port != null) + return false; + } else if (!destination_port.equals(other.destination_port)) + return false; + if (ethertype == null) { + if (other.ethertype != null) + return false; + } else if (!ethertype.equals(other.ethertype)) + return false; + if (protocol == null) { + if (other.protocol != null) + return false; + } else if (!protocol.equals(other.protocol)) + return false; + if (source_ip_addresses == null) { + if (other.source_ip_addresses != null) + return false; + } else if (!source_ip_addresses.equals(other.source_ip_addresses)) + return false; + if (source_port == null) { + if (other.source_port != null) + return false; + } else if (!source_port.equals(other.source_port)) + return false; + return true; + } + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/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 index 93de51e..f33f249 100644 --- 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 @@ -5,7 +5,7 @@ // 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, @@ -19,7 +19,7 @@ package com.cloud.network.nicira; import java.util.UUID; /** - * + * */ public abstract class NatRule { protected Match match; @@ -53,15 +53,15 @@ public abstract class NatRule { public void setType(String type) { this.type = type; } - + public int getOrder() { return order; } - + public void setOrder(int order) { this.order = order; } - + @Override public int hashCode() { final int prime = 31; @@ -101,7 +101,7 @@ public abstract class NatRule { return false; return true; } - + public boolean equalsIgnoreUuid(Object obj) { if (this == obj) return true; @@ -124,6 +124,6 @@ public abstract class NatRule { return false; return true; } - + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/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 12fa6c0..ea69a09 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 @@ -75,103 +75,103 @@ public class NiciraNvpApi { private static final Logger s_logger = Logger.getLogger(NiciraNvpApi.class); private final static String _protocol = "https"; private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager(); - + private String _name; private String _host; private String _adminuser; private String _adminpass; - + private HttpClient _client; private String _nvpversion; - + private Gson _gson; - + /* This factory method is protected so we can extend this * in the unittests. */ protected HttpClient createHttpClient() { - return new HttpClient(s_httpClientManager); + return new HttpClient(s_httpClientManager); } - + protected HttpMethod createMethod(String type, String uri) throws NiciraNvpApiException { - String url; + String url; try { 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); } - + if ("post".equalsIgnoreCase(type)) { - return new PostMethod(url); + return new PostMethod(url); } else if ("get".equalsIgnoreCase(type)) { - return new GetMethod(url); + return new GetMethod(url); } else if ("delete".equalsIgnoreCase(type)) { - return new DeleteMethod(url); + return new DeleteMethod(url); } else if ("put".equalsIgnoreCase(type)) { - return new PutMethod(url); + return new PutMethod(url); } else { - throw new NiciraNvpApiException("Requesting unknown method type"); + throw new NiciraNvpApiException("Requesting unknown method type"); } } public NiciraNvpApi() { _client = createHttpClient(); _client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); - - try { + + try { // Cast to ProtocolSocketFactory to avoid the deprecated constructor with the SecureProtocolSocketFactory parameter Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new TrustingProtocolSocketFactory(), 443)); } catch (IOException e) { s_logger.warn("Failed to register the TrustingProtocolSocketFactory, falling back to default SSLSocketFactory", e); } - + _gson = new GsonBuilder() - .registerTypeAdapter(NatRule.class, new NatRuleAdapter()) - .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) - .create(); - + .registerTypeAdapter(NatRule.class, new NatRuleAdapter()) + .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) + .create(); + } - + public void setControllerAddress(String address) { - this._host = address; + _host = address; } - + public void setAdminCredentials(String username, String password) { - this._adminuser = username; - this._adminpass = password; + _adminuser = username; + _adminpass = password; } - + /** - * Logs into the Nicira API. The cookie is stored in the <code>_authcookie<code> variable. + * Logs into the Nicira API. The cookie is stored in the + * <code>_authcookie<code> variable. * <p> * The method returns false if the login failed or the connection could not be made. - * */ protected void login() throws NiciraNvpApiException { String url; - + if (_host == null || _host.isEmpty() || - _adminuser == null || _adminuser.isEmpty() || - _adminpass == null || _adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); + _adminuser == null || _adminuser.isEmpty() || + _adminpass == null || _adminpass.isEmpty()) { + throw new NiciraNvpApiException("Hostname/credentials are null or empty"); } - + try { 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); } - + PostMethod pm = new PostMethod(url); pm.addParameter("username", _adminuser); pm.addParameter("password", _adminpass); - + try { _client.executeMethod(pm); } catch (HttpException e) { @@ -181,25 +181,25 @@ public class NiciraNvpApi { } finally { pm.releaseConnection(); } - + if (pm.getStatusCode() != HttpStatus.SC_OK) { s_logger.error("Nicira NVP API login failed : " + pm.getStatusText()); throw new NiciraNvpApiException("Nicira NVP API login failed " + pm.getStatusText()); } - + // Extract the version for later use if (pm.getResponseHeader("Server") != null) { _nvpversion = pm.getResponseHeader("Server").getValue(); s_logger.debug("NVP Controller reports version " + _nvpversion); } - + // Success; the cookie required for login is kept in _client } - + public LogicalSwitch createLogicalSwitch(LogicalSwitch logicalSwitch) throws NiciraNvpApiException { String uri = "/ws.v1/lswitch"; LogicalSwitch createdLogicalSwitch = executeCreateObject(logicalSwitch, new TypeToken<LogicalSwitch>(){}.getType(), uri, Collections.<String,String>emptyMap()); - + return createdLogicalSwitch; } @@ -207,11 +207,11 @@ public class NiciraNvpApi { String uri = "/ws.v1/lswitch/" + uuid; executeDeleteObject(uri); } - + public LogicalSwitchPort createLogicalSwitchPort(String logicalSwitchUuid, LogicalSwitchPort logicalSwitchPort) throws NiciraNvpApiException { String uri = "/ws.v1/lswitch/" + logicalSwitchUuid + "/lport"; LogicalSwitchPort createdLogicalSwitchPort = executeCreateObject(logicalSwitchPort, new TypeToken<LogicalSwitchPort>(){}.getType(), uri, Collections.<String,String>emptyMap());; - + return createdLogicalSwitchPort; } @@ -219,28 +219,28 @@ public class NiciraNvpApi { String uri = "/ws.v1/lswitch/" + logicalSwitchUuid + "/lport/" + logicalSwitchPortUuid + "/attachment"; executeUpdateObject(attachment, uri, Collections.<String,String>emptyMap()); } - + public void deleteLogicalSwitchPort(String logicalSwitchUuid, String logicalSwitchPortUuid) throws NiciraNvpApiException { String uri = "/ws.v1/lswitch/" + logicalSwitchUuid + "/lport/" + logicalSwitchPortUuid; executeDeleteObject(uri); } - + public String findLogicalSwitchPortUuidByVifAttachmentUuid(String logicalSwitchUuid, String vifAttachmentUuid) throws NiciraNvpApiException { String uri = "/ws.v1/lswitch/" + logicalSwitchUuid + "/lport"; Map<String,String> params = new HashMap<String,String>(); params.put("attachment_vif_uuid", vifAttachmentUuid); params.put("fields", "uuid"); - + NiciraNvpList<LogicalSwitchPort> lspl = executeRetrieveObject(new TypeToken<NiciraNvpList<LogicalSwitchPort>>(){}.getType(), uri, params); - + if (lspl == null || lspl.getResultCount() != 1) { throw new NiciraNvpApiException("Unexpected response from API"); } - + LogicalSwitchPort lsp = lspl.getResults().get(0); return lsp.getUuid(); } - + public ControlClusterStatus getControlClusterStatus() throws NiciraNvpApiException { String uri = "/ws.v1/control-cluster/status"; ControlClusterStatus ccs = executeRetrieveObject(new TypeToken<ControlClusterStatus>(){}.getType(), uri, null); @@ -253,118 +253,118 @@ public class NiciraNvpApi { Map<String,String> params = new HashMap<String,String>(); params.put("uuid", logicalSwitchPortUuid); params.put("fields", "uuid"); - + NiciraNvpList<LogicalSwitchPort> lspl = executeRetrieveObject(new TypeToken<NiciraNvpList<LogicalSwitchPort>>(){}.getType(), uri, params); - + if (lspl == null ) { throw new NiciraNvpApiException("Unexpected response from API"); } - + 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; + 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); + 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; + 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); + String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport/" + logicalRouterPortUuid; + + executeDeleteObject(uri); } public void modifyLogicalRouterPort(String logicalRouterUuid, LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException { - String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport/" + logicalRouterPort.getUuid(); - - executeUpdateObject(logicalRouterPort, uri, Collections.<String,String>emptyMap()); + String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport/" + logicalRouterPort.getUuid(); + + executeUpdateObject(logicalRouterPort, uri, Collections.<String,String>emptyMap()); } - + 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"; - - return executeCreateObject(natRule, new TypeToken<NatRule>(){}.getType(), uri, Collections.<String,String>emptyMap()); + String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat"; + + return executeCreateObject(natRule, new TypeToken<NatRule>(){}.getType(), uri, Collections.<String,String>emptyMap()); } - + public void modifyLogicalRouterNatRule(String logicalRouterUuid, NatRule natRule) throws NiciraNvpApiException { - String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat/" + natRule.getUuid(); - - executeUpdateObject(natRule, uri, Collections.<String,String>emptyMap()); + String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat/" + natRule.getUuid(); + + executeUpdateObject(natRule, uri, Collections.<String,String>emptyMap()); } - + public void deleteLogicalRouterNatRule(String logicalRouterUuid, UUID natRuleUuid) throws NiciraNvpApiException { - String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat/" + natRuleUuid.toString(); - - executeDeleteObject(uri); + String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat/" + natRuleUuid.toString(); + + executeDeleteObject(uri); } - + public NiciraNvpList<LogicalRouterPort> findLogicalRouterPortByGatewayServiceAndVlanId(String logicalRouterUuid, String gatewayServiceUuid, long vlanId) throws NiciraNvpApiException { - String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport"; + String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport"; Map<String,String> params = new HashMap<String,String>(); params.put("attachment_gwsvc_uuid", gatewayServiceUuid); params.put("attachment_vlan", "0"); params.put("fields","*"); - + return executeRetrieveObject(new TypeToken<NiciraNvpList<LogicalRouterPort>>(){}.getType(), uri, params); } - + public LogicalRouterConfig findOneLogicalRouterByUuid(String logicalRouterUuid) throws NiciraNvpApiException { - String uri = "/ws.v1/lrouter/" + logicalRouterUuid; - - return executeRetrieveObject(new TypeToken<LogicalRouterConfig>(){}.getType(), uri, Collections.<String,String>emptyMap()); + String uri = "/ws.v1/lrouter/" + logicalRouterUuid; + + return executeRetrieveObject(new TypeToken<LogicalRouterConfig>(){}.getType(), uri, Collections.<String,String>emptyMap()); } - + public void updateLogicalRouterPortConfig(String logicalRouterUuid, LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException { - String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport" + logicalRouterPort.getUuid(); - - executeUpdateObject(logicalRouterPort, uri, Collections.<String,String>emptyMap()); + String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport" + logicalRouterPort.getUuid(); + + executeUpdateObject(logicalRouterPort, uri, Collections.<String,String>emptyMap()); } - + public NiciraNvpList<NatRule> findNatRulesByLogicalRouterUuid(String logicalRouterUuid) throws NiciraNvpApiException { - String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat"; + String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat"; Map<String,String> params = new HashMap<String,String>(); params.put("fields","*"); - - return executeRetrieveObject(new TypeToken<NiciraNvpList<NatRule>>(){}.getType(), uri, params); + + return executeRetrieveObject(new TypeToken<NiciraNvpList<NatRule>>(){}.getType(), uri, params); } - + public NiciraNvpList<LogicalRouterPort> findLogicalRouterPortByGatewayServiceUuid(String logicalRouterUuid, String l3GatewayServiceUuid) throws NiciraNvpApiException { - String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport"; - Map<String,String> params = new HashMap<String,String>(); - params.put("fields", "*"); - params.put("attachment_gwsvc_uuid", l3GatewayServiceUuid); - - return executeRetrieveObject(new TypeToken<NiciraNvpList<LogicalRouterPort>>(){}.getType(), uri, params); - } - + String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport"; + Map<String,String> params = new HashMap<String,String>(); + params.put("fields", "*"); + params.put("attachment_gwsvc_uuid", l3GatewayServiceUuid); + + return executeRetrieveObject(new TypeToken<NiciraNvpList<LogicalRouterPort>>(){}.getType(), uri, params); + } + protected <T> void executeUpdateObject(T newObject, String uri, Map<String,String> parameters) throws NiciraNvpApiException { if (_host == null || _host.isEmpty() || - _adminuser == null || _adminuser.isEmpty() || - _adminpass == null || _adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); + _adminuser == null || _adminuser.isEmpty() || + _adminpass == null || _adminpass.isEmpty()) { + throw new NiciraNvpApiException("Hostname/credentials are null or empty"); } - + PutMethod pm = (PutMethod) createMethod("put", uri); pm.setRequestHeader("Content-Type", "application/json"); try { @@ -373,9 +373,9 @@ public class NiciraNvpApi { } catch (UnsupportedEncodingException e) { throw new NiciraNvpApiException("Failed to encode json request body", e); } - + executeMethod(pm); - + if (pm.getStatusCode() != HttpStatus.SC_OK) { String errorMessage = responseToErrorMessage(pm); pm.releaseConnection(); @@ -384,14 +384,14 @@ public class NiciraNvpApi { } pm.releaseConnection(); } - + protected <T> T executeCreateObject(T newObject, Type returnObjectType, String uri, Map<String,String> parameters) throws NiciraNvpApiException { if (_host == null || _host.isEmpty() || - _adminuser == null || _adminuser.isEmpty() || - _adminpass == null || _adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); + _adminuser == null || _adminuser.isEmpty() || + _adminpass == null || _adminpass.isEmpty()) { + throw new NiciraNvpApiException("Hostname/credentials are null or empty"); } - + PostMethod pm = (PostMethod) createMethod("post", uri); pm.setRequestHeader("Content-Type", "application/json"); try { @@ -400,16 +400,16 @@ public class NiciraNvpApi { } catch (UnsupportedEncodingException e) { throw new NiciraNvpApiException("Failed to encode json request body", e); } - + executeMethod(pm); - + if (pm.getStatusCode() != HttpStatus.SC_CREATED) { String errorMessage = responseToErrorMessage(pm); pm.releaseConnection(); s_logger.error("Failed to create object : " + errorMessage); throw new NiciraNvpApiException("Failed to create object : " + errorMessage); } - + T result; try { result = (T)_gson.fromJson(pm.getResponseBodyAsString(), TypeToken.get(newObject.getClass()).getType()); @@ -418,22 +418,22 @@ public class NiciraNvpApi { } finally { pm.releaseConnection(); } - - return result; + + return result; } - + protected void executeDeleteObject(String uri) throws NiciraNvpApiException { if (_host == null || _host.isEmpty() || - _adminuser == null || _adminuser.isEmpty() || - _adminpass == null || _adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); + _adminuser == null || _adminuser.isEmpty() || + _adminpass == null || _adminpass.isEmpty()) { + throw new NiciraNvpApiException("Hostname/credentials are null or empty"); } - + DeleteMethod dm = (DeleteMethod) createMethod("delete", uri); dm.setRequestHeader("Content-Type", "application/json"); - + executeMethod(dm); - + if (dm.getStatusCode() != HttpStatus.SC_NO_CONTENT) { String errorMessage = responseToErrorMessage(dm); dm.releaseConnection(); @@ -442,33 +442,33 @@ public class NiciraNvpApi { } dm.releaseConnection(); } - + protected <T> T executeRetrieveObject(Type returnObjectType, String uri, Map<String,String> parameters) throws NiciraNvpApiException { if (_host == null || _host.isEmpty() || - _adminuser == null || _adminuser.isEmpty() || - _adminpass == null || _adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); + _adminuser == null || _adminuser.isEmpty() || + _adminpass == null || _adminpass.isEmpty()) { + throw new NiciraNvpApiException("Hostname/credentials are null or empty"); } - + GetMethod gm = (GetMethod) createMethod("get", uri); gm.setRequestHeader("Content-Type", "application/json"); if (parameters != null && !parameters.isEmpty()) { - List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(parameters.size()); - for (Entry<String,String> e : parameters.entrySet()) { - nameValuePairs.add(new NameValuePair(e.getKey(), e.getValue())); - } - gm.setQueryString(nameValuePairs.toArray(new NameValuePair[0])); + List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(parameters.size()); + for (Entry<String,String> e : parameters.entrySet()) { + nameValuePairs.add(new NameValuePair(e.getKey(), e.getValue())); + } + gm.setQueryString(nameValuePairs.toArray(new NameValuePair[0])); } - + executeMethod(gm); - + if (gm.getStatusCode() != HttpStatus.SC_OK) { String errorMessage = responseToErrorMessage(gm); gm.releaseConnection(); s_logger.error("Failed to retrieve object : " + errorMessage); throw new NiciraNvpApiException("Failed to retrieve object : " + errorMessage); } - + T returnValue; try { returnValue = (T)_gson.fromJson(gm.getResponseBodyAsString(), returnObjectType); @@ -480,7 +480,7 @@ public class NiciraNvpApi { } return returnValue; } - + protected void executeMethod(HttpMethodBase method) throws NiciraNvpApiException { try { _client.executeMethod(method); @@ -497,13 +497,13 @@ public class NiciraNvpApi { } catch (IOException e) { s_logger.error("IOException caught while trying to connect to the Nicira NVP Controller", e); method.releaseConnection(); - throw new NiciraNvpApiException("API call to Nicira NVP Controller Failed", e); + throw new NiciraNvpApiException("API call to Nicira NVP Controller Failed", e); } } - + private String responseToErrorMessage(HttpMethodBase method) { assert method.isRequestSent() : "no use getting an error message unless the request is sent"; - + if ("text/html".equals(method.getResponseHeader("Content-Type").getValue())) { // The error message is the response content // Safety margin of 1024 characters, anything longer is probably useless @@ -514,38 +514,41 @@ public class NiciraNvpApi { s_logger.debug("Error while loading response body", e); } } - + // The default return method.getStatusText(); } - - /* The Nicira controller uses a self-signed certificate. The + + /* The Nicira controller uses a self-signed certificate. The * TrustingProtocolSocketFactory will accept any provided - * certificate when making an SSL connection to the SDN + * certificate when making an SSL connection to the SDN * Manager */ private class TrustingProtocolSocketFactory implements SecureProtocolSocketFactory { private SSLSocketFactory ssf; - + public TrustingProtocolSocketFactory() throws IOException { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { - new X509TrustManager() { - public X509Certificate[] getAcceptedIssuers() { - return null; - } - - public void checkClientTrusted(X509Certificate[] certs, String authType) { - // Trust always - } - - public void checkServerTrusted(X509Certificate[] certs, String authType) { - // Trust always + new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) { + // Trust always + } + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) { + // Trust always + } } - } }; - + try { // Install the all-trusting trust manager SSLContext sc = SSLContext.getInstance("SSL"); @@ -557,10 +560,10 @@ public class NiciraNvpApi { throw new IOException(e); } } - + @Override public Socket createSocket(String host, int port) throws IOException, - UnknownHostException { + UnknownHostException { return ssf.createSocket(host, port); } @@ -592,21 +595,19 @@ public class NiciraNvpApi { } } - + } - + public static class NatRuleAdapter implements JsonDeserializer<NatRule> { @Override public NatRule deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = jsonElement.getAsJsonObject(); - NatRule natRule = null; - if (!jsonObject.has("type")) { throw new JsonParseException("Deserializing as a NatRule, but no type present in the json object"); } - + String natRuleType = jsonObject.get("type").getAsString(); if ("SourceNatRule".equals(natRuleType)) { return context.deserialize(jsonElement, SourceNatRule.class); @@ -614,7 +615,7 @@ public class NiciraNvpApi { else if ("DestinationNatRule".equals(natRuleType)) { return context.deserialize(jsonElement, DestinationNatRule.class); } - + throw new JsonParseException("Failed to deserialize type \"" + natRuleType + "\""); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java index c97e40e..9d78e84 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java @@ -37,9 +37,9 @@ public class NiciraNvpList<T> { public void setResultCount(int result_count) { this.result_count = result_count; } - + public boolean isEmpty() { - return result_count == 0; + return result_count == 0; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java index 157c3b5..a5dd3bd 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java @@ -22,9 +22,9 @@ public class NiciraNvpTag { private static final Logger s_logger = Logger.getLogger(NiciraNvpTag.class); private String scope; private String tag; - + public NiciraNvpTag() {} - + public NiciraNvpTag(String scope, String tag) { this.scope = scope; if (tag.length() > 40) { @@ -34,19 +34,19 @@ public class NiciraNvpTag { this.tag = tag; } } - + public String getScope() { return scope; } - + public void setScope(String scope) { this.scope = scope; } - + public String getTag() { return tag; } - + public void setTag(String tag) { if (tag.length() > 40) { s_logger.warn("tag \"" + tag + "\" too long, truncating to 40 characters"); @@ -55,5 +55,5 @@ public class NiciraNvpTag { this.tag = tag; } } - + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java index e57c249..137f071 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java @@ -5,7 +5,7 @@ // 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, @@ -17,23 +17,22 @@ package com.cloud.network.nicira; /** - * + * */ public class PatchAttachment extends Attachment { - private final String type = "PatchAttachment"; - private String peer_port_uuid; - - public PatchAttachment(String peerPortUuid) { - this.peer_port_uuid = peerPortUuid; - } + private final String type = "PatchAttachment"; + private String peer_port_uuid; + + public PatchAttachment(String peerPortUuid) { + peer_port_uuid = peerPortUuid; + } + + public String getPeerPortUuid() { + return peer_port_uuid; + } - public String getPeerPortUuid() { - return peer_port_uuid; - } + public void setPeerPortUuid(String peerPortUuid) { + peer_port_uuid = peerPortUuid; + } - public void setPeerPortUuid(String peerPortUuid) { - this.peer_port_uuid = peerPortUuid; - } - - } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/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 index c018af3..a204e55 100644 --- 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 @@ -5,7 +5,7 @@ // 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, @@ -17,22 +17,22 @@ package com.cloud.network.nicira; /** - * + * */ public class RouterNextHop { - private String gateway_ip_address; - private String type = "RouterNextHop"; - - public RouterNextHop(String gatewayIpAddress) { - this.gateway_ip_address = gatewayIpAddress; - } - - public String getGatewayIpAddress() { - return gateway_ip_address; - } - - public void setGatewayIpAddress(String gateway_ip_address) { - this.gateway_ip_address = gateway_ip_address; - } - + private String gateway_ip_address; + private String type = "RouterNextHop"; + + public RouterNextHop(String gatewayIpAddress) { + gateway_ip_address = gatewayIpAddress; + } + + 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/cloudstack/blob/256763cf/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 index b4eda44..1228deb 100644 --- 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 @@ -5,7 +5,7 @@ // 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, @@ -17,22 +17,22 @@ 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; - } - + 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/cloudstack/blob/256763cf/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 index 4132da4..910f830 100644 --- 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 @@ -20,7 +20,7 @@ public class SourceNatRule extends NatRule { private String toSourceIpAddressMax; private String toSourceIpAddressMin; private Integer toSourcePort; - + public SourceNatRule() { setType("SourceNatRule"); } @@ -119,5 +119,5 @@ public class SourceNatRule extends NatRule { return false; return true; } - + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java index e55d759..9c5f44d 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java @@ -19,9 +19,9 @@ package com.cloud.network.nicira; public class TransportZoneBinding { private String zone_uuid; private String transport_type; - + public TransportZoneBinding() {} - + public TransportZoneBinding(String zone_uuid, String transport_type) { this.zone_uuid = zone_uuid; this.transport_type = transport_type; @@ -42,5 +42,5 @@ public class TransportZoneBinding { public void setTransport_type(String transport_type) { this.transport_type = transport_type; } - + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java index dc87a5a..3a0b5f3 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java @@ -19,12 +19,12 @@ package com.cloud.network.nicira; public class VifAttachment extends Attachment { private final String type = "VifAttachment"; private String vif_uuid; - + public VifAttachment() { } - + public VifAttachment(String vifUuid) { - this.vif_uuid = vifUuid; + vif_uuid = vifUuid; } public String getVif_uuid() { @@ -38,5 +38,5 @@ public class VifAttachment extends Attachment { public String getType() { return type; } - + }
