diff --git a/Torpedo/src/etri/sdn/controller/OFController.java b/Torpedo/src/etri/sdn/controller/OFController.java index d2d1816e..3765e6be 100644 --- a/Torpedo/src/etri/sdn/controller/OFController.java +++ b/Torpedo/src/etri/sdn/controller/OFController.java @@ -166,8 +166,7 @@ public void run() { } catch ( Exception | Error e ) { logger.error(e.getMessage()); this.controller.removeSelf(); - return; // end this controller thread. - } + } } /** @@ -426,29 +425,27 @@ public void addSwitch(long id, IOFSwitch sw) { public final boolean handleDisconnectEvent(Connection conn) { assert( conn.getSwitch() != null ); - - if ( conn.getSwitch() != null ) { - - try { - conn.getSwitch().getId(); - - for (OFModule m: modules) { - m.processDisconnect(conn); - } - } catch ( RuntimeException e ) { - // FEATURES_REPLY is not exchanged. - } - - try { - switches.remove( conn.getSwitch().getId() ); - } catch ( RuntimeException e ) { - // this catch clause is for catching RuntimeException - // raised within conn.getSwitch().getId(). - // this exception is raised when the connection is abruptly cut - // before FEATURE_REPLY is received from the peer. - // So, we do nothing for this exception. - } - } + + + try { + conn.getSwitch().getId(); + + for (OFModule m: modules) { + m.processDisconnect(conn); + } + } catch ( RuntimeException e ) { + // FEATURES_REPLY is not exchanged. + } + + try { + switches.remove( conn.getSwitch().getId() ); + } catch ( RuntimeException e ) { + // this catch clause is for catching RuntimeException + // raised within conn.getSwitch().getId(). + // this exception is raised when the connection is abruptly cut + // before FEATURE_REPLY is received from the peer. + // So, we do nothing for this exception. + } return true; } @@ -488,9 +485,7 @@ public final OFModel[] getModels() { if ( models == null ) { continue; } - for ( int i = 0; i < models.length; ++i ) { - l.add( models[i] ); - } + Collections.addAll(l, models); } return l.toArray(new OFModel[l.size()]); diff --git a/Torpedo/src/etri/sdn/controller/module/devicemanager/Device.java b/Torpedo/src/etri/sdn/controller/module/devicemanager/Device.java index bc785929..2289bb8d 100644 --- a/Torpedo/src/etri/sdn/controller/module/devicemanager/Device.java +++ b/Torpedo/src/etri/sdn/controller/module/devicemanager/Device.java @@ -288,11 +288,9 @@ protected boolean updateAttachmentPoint() { // Prepare the new attachment point list. if (moved) { - if ( newMap != null ) { - this.attachmentPoints.retainAll( newMap.values() ); - this.attachmentPoints.addAllAbsent( newMap.values() ); - } - } + this.attachmentPoints.retainAll( newMap.values() ); + this.attachmentPoints.addAllAbsent( newMap.values() ); + } // empty the old ap list. this.oldAPs.clear(); diff --git a/Torpedo/src/etri/sdn/controller/module/devicemanager/DeviceIterator.java b/Torpedo/src/etri/sdn/controller/module/devicemanager/DeviceIterator.java index 5c4a64ed..2102a695 100644 --- a/Torpedo/src/etri/sdn/controller/module/devicemanager/DeviceIterator.java +++ b/Torpedo/src/etri/sdn/controller/module/devicemanager/DeviceIterator.java @@ -99,18 +99,19 @@ protected boolean matches(Device value) { if (sps == null) return false; match = false; - for (SwitchPort sp : sps) { - if (switchDPID != null) { - if (switchDPID.longValue() != sp.getSwitchDPID()) - return false; - } - if (switchPort != null) { - if (! switchPort.equals(sp.getPort())) - return false; - } - match = true; - break; - } + if (sps.length > 0) { + SwitchPort sp = sps[0]; + if (switchDPID != null) { + if (switchDPID.longValue() != sp.getSwitchDPID()) + return false; + } + if (switchPort != null) { + if (!switchPort.equals(sp.getPort())) + return false; + } + match = true; + } + if (!match) return false; } return true; diff --git a/Torpedo/src/etri/sdn/controller/module/devicemanager/Devices.java b/Torpedo/src/etri/sdn/controller/module/devicemanager/Devices.java index 444c3402..50259d75 100644 --- a/Torpedo/src/etri/sdn/controller/module/devicemanager/Devices.java +++ b/Torpedo/src/etri/sdn/controller/module/devicemanager/Devices.java @@ -117,7 +117,7 @@ private static class DeviceUpdate { * The enum set of DeviceUpdate events */ public enum Change { - ADD, DELETE, CHANGE; + ADD, DELETE, CHANGE, } /** @@ -1389,10 +1389,8 @@ public void removeSuppressAPs(long swId, OFPort port) { * @return true if suppressedAPs includes switchPort, false otherwise */ public boolean isSuppressedAP(SwitchPort switchPort) { - if ( suppressedAPs.contains(switchPort) ) - return true; - return false; - } + return suppressedAPs.contains(switchPort); + } /** * Returns information of devices that have more than one attachment point. @@ -1507,7 +1505,6 @@ public void handle(Request request, Response response) { response.setEntity(r, MediaType.APPLICATION_JSON); } catch (Exception e) { e.printStackTrace(); - return; } } } diff --git a/Torpedo/src/etri/sdn/controller/module/devicemanager/Entity.java b/Torpedo/src/etri/sdn/controller/module/devicemanager/Entity.java index 406e1db1..75715f22 100644 --- a/Torpedo/src/etri/sdn/controller/module/devicemanager/Entity.java +++ b/Torpedo/src/etri/sdn/controller/module/devicemanager/Entity.java @@ -44,7 +44,7 @@ public class Entity implements Comparable { * * @see etri.sdn.controller.module.devicemanager.Entity */ - protected static int ACTIVITY_TIMEOUT = 30000; + protected static final int ACTIVITY_TIMEOUT = 30000; /** * The MAC address associated with this entity diff --git a/Torpedo/src/etri/sdn/controller/module/firewall/FirewallEntryTable.java b/Torpedo/src/etri/sdn/controller/module/firewall/FirewallEntryTable.java index 539e67c6..faa8e3a2 100644 --- a/Torpedo/src/etri/sdn/controller/module/firewall/FirewallEntryTable.java +++ b/Torpedo/src/etri/sdn/controller/module/firewall/FirewallEntryTable.java @@ -22,8 +22,7 @@ public class FirewallEntryTable extends TreeMap>{ * */ public Map getFirewallEntry(String ruleid) { - Map entry = super.get(ruleid); - return entry; + return super.get(ruleid); } /** diff --git a/Torpedo/src/etri/sdn/controller/module/firewall/FirewallRule.java b/Torpedo/src/etri/sdn/controller/module/firewall/FirewallRule.java index 540073f8..0b361969 100644 --- a/Torpedo/src/etri/sdn/controller/module/firewall/FirewallRule.java +++ b/Torpedo/src/etri/sdn/controller/module/firewall/FirewallRule.java @@ -495,7 +495,7 @@ public static String jsonToSubnetMask(String fmJson) throws IOException { continue; if (n == "subnet-mask") { - result = (String)jp.getText(); + result = jp.getText(); } } @@ -541,7 +541,7 @@ public static FirewallRule jsonToFirewallRule(String fmJson) throws IOException // This is currently only applicable for remove(). In store(), ruleid takes a random number if (n == "ruleid") { - rule.ruleid = Integer.parseInt((String)jp.getText()); + rule.ruleid = Integer.parseInt(jp.getText()); } // This assumes user having dpid info for involved switches diff --git a/Torpedo/src/etri/sdn/controller/module/firewall/OFFirewallRuleReplySerializerModule.java b/Torpedo/src/etri/sdn/controller/module/firewall/OFFirewallRuleReplySerializerModule.java index 5489fe58..fa8c1dd3 100644 --- a/Torpedo/src/etri/sdn/controller/module/firewall/OFFirewallRuleReplySerializerModule.java +++ b/Torpedo/src/etri/sdn/controller/module/firewall/OFFirewallRuleReplySerializerModule.java @@ -19,10 +19,10 @@ final class OFFirewallRuleSerializer extends JsonSerializer { @Override public void serialize(FirewallRule rule, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + throws IOException { jgen.writeStartObject(); - jgen.writeNumberField("ruleid", (Integer)rule.ruleid); + jgen.writeNumberField("ruleid", rule.ruleid); jgen.writeNumberField("dpid", rule.dpid); jgen.writeNumberField("in_port", rule.in_port); jgen.writeNumberField("dl_src", rule.dl_src); diff --git a/Torpedo/src/etri/sdn/controller/module/forwarding/Forwarding.java b/Torpedo/src/etri/sdn/controller/module/forwarding/Forwarding.java index d5a9441f..3c7334c8 100644 --- a/Torpedo/src/etri/sdn/controller/module/forwarding/Forwarding.java +++ b/Torpedo/src/etri/sdn/controller/module/forwarding/Forwarding.java @@ -393,7 +393,6 @@ protected void doFlood(IOFSwitch sw, OFPacketIn pi, MessageContext cntx) { sw, pi, po, e); } - return; } @Override diff --git a/Torpedo/src/etri/sdn/controller/module/learningmac/OFMLearningMac.java b/Torpedo/src/etri/sdn/controller/module/learningmac/OFMLearningMac.java index 9fdbe459..7533ef5d 100644 --- a/Torpedo/src/etri/sdn/controller/module/learningmac/OFMLearningMac.java +++ b/Torpedo/src/etri/sdn/controller/module/learningmac/OFMLearningMac.java @@ -414,8 +414,9 @@ private boolean processPacketInMessage(Connection conn, MessageContext context, if ( reverse != null ) { target.setExact(MatchField.ETH_SRC, destMac); } - - this.writeFlowMod(conn.getSwitch(), OFFlowModCommand.ADD, OFBufferId.NO_BUFFER, + + assert reverse != null; + this.writeFlowMod(conn.getSwitch(), OFFlowModCommand.ADD, OFBufferId.NO_BUFFER, reverse.build(), inputPort, out ); } } diff --git a/Torpedo/src/etri/sdn/controller/module/linkdiscovery/ILinkDiscovery.java b/Torpedo/src/etri/sdn/controller/module/linkdiscovery/ILinkDiscovery.java index 03f8121c..da2f63aa 100644 --- a/Torpedo/src/etri/sdn/controller/module/linkdiscovery/ILinkDiscovery.java +++ b/Torpedo/src/etri/sdn/controller/module/linkdiscovery/ILinkDiscovery.java @@ -21,7 +21,7 @@ public interface ILinkDiscovery { */ public enum SwitchType { BASIC_SWITCH, CORE_SWITCH - }; + } /** * This enum defines the type of each link. @@ -55,5 +55,5 @@ public String toString() { return "tunnel"; } } - }; + } } diff --git a/Torpedo/src/etri/sdn/controller/module/linkdiscovery/Links.java b/Torpedo/src/etri/sdn/controller/module/linkdiscovery/Links.java index b0980438..06e1efbc 100644 --- a/Torpedo/src/etri/sdn/controller/module/linkdiscovery/Links.java +++ b/Torpedo/src/etri/sdn/controller/module/linkdiscovery/Links.java @@ -651,7 +651,6 @@ public void handle(Request request, Response response) { response.setEntity(r, MediaType.APPLICATION_JSON); } catch (Exception e) { e.printStackTrace(); - return; } } } diff --git a/Torpedo/src/etri/sdn/controller/module/ml2/NetworkConfiguration.java b/Torpedo/src/etri/sdn/controller/module/ml2/NetworkConfiguration.java index a76068c1..64002fe5 100644 --- a/Torpedo/src/etri/sdn/controller/module/ml2/NetworkConfiguration.java +++ b/Torpedo/src/etri/sdn/controller/module/ml2/NetworkConfiguration.java @@ -9,20 +9,19 @@ class NetworkConfiguration extends OFModel { private OFMOpenstackML2Connector parent = null; private RESTApi[] apis = null; - public NetworkConfiguration(OFMOpenstackML2Connector parent) - { - this.parent = parent; - this.apis = Arrays.asList( - new RESTApi(RestNetwork.neutronNetAll, new RestNetwork(this)), - new RESTApi(RestNetwork.neutronNet, new RestNetwork(this)), - new RESTApi(RestNetwork.neutronNetIRIS, new RestNetwork(this)), - new RESTApi(RestPort.neutronPortAll, new RestPort(this)), - new RESTApi(RestPort.neutronPort, new RestPort(this)), - new RESTApi(RestPort.neutronPortIRIS, new RestPort(this)), - new RESTApi(RestSubnet.neutronSubnetAll, new RestSubnet(this)), - new RESTApi(RestSubnet.neutronSubnet, new RestSubnet(this)), - new RESTApi(RestSubnet.neutronSubnetIRIS, new RestSubnet(this)) - ).toArray( new RESTApi[0] ); + public NetworkConfiguration(OFMOpenstackML2Connector parent) { + this.parent = parent; + this.apis = new RESTApi[]{ + new RESTApi(RestNetwork.neutronNetAll, new RestNetwork(this)), + new RESTApi(RestNetwork.neutronNet, new RestNetwork(this)), + new RESTApi(RestNetwork.neutronNetIRIS, new RestNetwork(this)), + new RESTApi(RestPort.neutronPortAll, new RestPort(this)), + new RESTApi(RestPort.neutronPort, new RestPort(this)), + new RESTApi(RestPort.neutronPortIRIS, new RestPort(this)), + new RESTApi(RestSubnet.neutronSubnetAll, new RestSubnet(this)), + new RESTApi(RestSubnet.neutronSubnet, new RestSubnet(this)), + new RESTApi(RestSubnet.neutronSubnetIRIS, new RestSubnet(this)), + }; } OFMOpenstackML2Connector getModule() { diff --git a/Torpedo/src/etri/sdn/controller/module/ml2/OFMOpenstackML2Connector.java b/Torpedo/src/etri/sdn/controller/module/ml2/OFMOpenstackML2Connector.java index 57fa49df..ab5a5ced 100644 --- a/Torpedo/src/etri/sdn/controller/module/ml2/OFMOpenstackML2Connector.java +++ b/Torpedo/src/etri/sdn/controller/module/ml2/OFMOpenstackML2Connector.java @@ -261,7 +261,7 @@ public String listNetworks(String netId, String netKey, String netValue) { Map vInfo = omm.readValue(jsonStr, new TypeReference>(){}); for(Entry vEntry : vInfo.entrySet()) { - String vEntryKey = vEntry.getKey() == null ? "null" : vEntry.getKey().toString(); + String vEntryKey = vEntry.getKey() == null ? "null" : vEntry.getKey(); String vEntryValue = vEntry.getValue() == null ? "null" : vEntry.getValue().toString(); if(netKey.equals(vEntryKey) && netValue.equals(vEntryValue)) { @@ -383,7 +383,7 @@ public String listSubnets(String subId, String subKey, String subValue) { Map vInfo = omm.readValue(jsonStr, new TypeReference>(){}); for(Entry vEntry : vInfo.entrySet()) { - String vEntryKey = vEntry.getKey() == null ? "null" : vEntry.getKey().toString(); + String vEntryKey = vEntry.getKey() == null ? "null" : vEntry.getKey(); String vEntryValue = vEntry.getValue() == null ? "null" : vEntry.getValue().toString(); if(subKey.equals(vEntryKey) && subValue.equals(vEntryValue)) { @@ -513,7 +513,7 @@ public String listPorts(String porId, String porKey, String porValue) { Map vInfo = omm.readValue(jsonStr, new TypeReference>(){}); for(Entry vEntry : vInfo.entrySet()) { - String vEntryKey = vEntry.getKey() == null ? "null" : vEntry.getKey().toString(); + String vEntryKey = vEntry.getKey() == null ? "null" : vEntry.getKey(); String vEntryValue = vEntry.getValue() == null ? "null" : vEntry.getValue().toString(); if(porKey.equals(vEntryKey) && porValue.equals(vEntryValue)) { diff --git a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualNetwork.java b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualNetwork.java index 2afd0365..e7f339da 100644 --- a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualNetwork.java +++ b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualNetwork.java @@ -39,8 +39,6 @@ public VirtualNetwork(NetworkDefinition network) { this.shared = network.shared; this.netId = network.netId; this.provider_segmentation_id = network.provider_segmentation_id; - - return; } /** @@ -49,7 +47,6 @@ public VirtualNetwork(NetworkDefinition network) { */ public void setNetName(String netName){ this.netName = netName; - return; } /** @@ -58,7 +55,6 @@ public void setNetName(String netName){ */ public void setProviderPhysicalNetwork(String provider_physical_network){ this.provider_physical_network = provider_physical_network; - return; } /** @@ -67,7 +63,6 @@ public void setProviderPhysicalNetwork(String provider_physical_network){ */ public void setAdminStateUp(String admin_state_up){ this.admin_state_up = admin_state_up; - return; } /** @@ -76,7 +71,6 @@ public void setAdminStateUp(String admin_state_up){ */ public void setProviderNetworkType(String provider_network_type){ this.provider_network_type = provider_network_type; - return; } /** @@ -85,7 +79,6 @@ public void setProviderNetworkType(String provider_network_type){ */ public void setRouterExternal(String router_external){ this.router_external = router_external; - return; } /** @@ -94,7 +87,6 @@ public void setRouterExternal(String router_external){ */ public void setShared(String shared){ this.shared = shared; - return; } /** @@ -103,19 +95,14 @@ public void setShared(String shared){ */ public void setProviderSegmentationId(String provider_segmentation_id){ this.provider_segmentation_id = provider_segmentation_id; - return; } public void addSubnets(String subId, String subName) { this.subNameToGuid.put(subId, subName); - - return; } public void delSubnets(String subId) { this.subNameToGuid.remove(subId); - - return; } } diff --git a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualNetworkSerializer.java b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualNetworkSerializer.java index 864c45a1..de4b58e7 100644 --- a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualNetworkSerializer.java +++ b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualNetworkSerializer.java @@ -11,13 +11,13 @@ public class VirtualNetworkSerializer extends JsonSerializer { @Override - public void serialize(VirtualNetwork vNet, JsonGenerator jGen, SerializerProvider serializer) throws IOException, JsonProcessingException { + public void serialize(VirtualNetwork vNet, JsonGenerator jGen, SerializerProvider serializer) throws IOException { jGen.writeStartObject(); jGen.writeStringField("status", vNet.status); jGen.writeArrayFieldStart("subnets"); for (Entry entry : vNet.subNameToGuid.entrySet()) { - jGen.writeString(entry.getKey().toString()); + jGen.writeString(entry.getKey()); } jGen.writeEndArray(); diff --git a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualPort.java b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualPort.java index 10f2f6d9..f71a1b8a 100644 --- a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualPort.java +++ b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualPort.java @@ -53,8 +53,6 @@ public VirtualPort(PortDefinition port) { this.binding_vnic_type = port.binding_vnic_type; this.binding_vif_type = port.binding_vif_type; this.mac_address = port.mac_address; - - return; } /** @@ -63,7 +61,6 @@ public VirtualPort(PortDefinition port) { */ public void setBindingHostId(String binding_host_id) { this.binding_host_id = binding_host_id; - return; } /** @@ -72,7 +69,6 @@ public void setBindingHostId(String binding_host_id) { */ public void setAllowedAddressPairs(List allowed_address_pairs) { this.allowed_address_pairs = allowed_address_pairs; - return; } /** @@ -81,7 +77,6 @@ public void setAllowedAddressPairs(List allowed_address_pairs) { */ public void setExtraDhcpOpts(List extra_dhcp_opts) { this.extra_dhcp_opts = extra_dhcp_opts; - return; } /** @@ -90,7 +85,6 @@ public void setExtraDhcpOpts(List extra_dhcp_opts) { */ public void setDeviceOwner(String device_owner) { this.device_owner = device_owner; - return; } /** @@ -99,7 +93,6 @@ public void setDeviceOwner(String device_owner) { */ public void setBindingProfile(Map binding_profile) { this.binding_profile = binding_profile; - return; } /** @@ -108,7 +101,6 @@ public void setBindingProfile(Map binding_profile) { */ public void setSecurityGroups(List> security_groups) { this.security_groups = security_groups; - return; } /** @@ -117,7 +109,6 @@ public void setSecurityGroups(List> security_groups) { */ public void setDeviceId(String device_id) { this.device_id = device_id; - return; } /** @@ -126,7 +117,6 @@ public void setDeviceId(String device_id) { */ public void setPorName(String porName) { this.porName = porName; - return; } /** @@ -135,7 +125,6 @@ public void setPorName(String porName) { */ public void setAdminStateUp(String admin_state_up) { this.admin_state_up = admin_state_up; - return; } /** @@ -144,7 +133,6 @@ public void setAdminStateUp(String admin_state_up) { */ public void setBindingVifDetails(Map binding_vif_details) { this.binding_vif_details = binding_vif_details; - return; } /** @@ -153,7 +141,6 @@ public void setBindingVifDetails(Map binding_vif_details) { */ public void setBindingVifDetails(String binding_vif_detail) { this.binding_vif_detail = binding_vif_detail; - return; } /** @@ -162,7 +149,6 @@ public void setBindingVifDetails(String binding_vif_detail) { */ public void setBindingVnicType(String binding_vnic_type) { this.binding_vnic_type = binding_vnic_type; - return; } /** @@ -171,7 +157,6 @@ public void setBindingVnicType(String binding_vnic_type) { */ public void setBindingVifType(String binding_vif_type) { this.binding_vif_type = binding_vif_type; - return; } } diff --git a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualPortSerializer.java b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualPortSerializer.java index e8a97cae..295b5975 100644 --- a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualPortSerializer.java +++ b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualPortSerializer.java @@ -13,7 +13,7 @@ public class VirtualPortSerializer extends JsonSerializer { // REST GET @Override - public void serialize(VirtualPort vPor, JsonGenerator jGen, SerializerProvider serializer) throws IOException, JsonProcessingException { + public void serialize(VirtualPort vPor, JsonGenerator jGen, SerializerProvider serializer) throws IOException { jGen.writeStartObject(); jGen.writeStringField("binding:host_id", vPor.binding_host_id); @@ -31,7 +31,7 @@ public void serialize(VirtualPort vPor, JsonGenerator jGen, SerializerProvider s jGen.writeObjectFieldStart("binding_profile"); if(vPor.binding_profile != null) { for (Entry entry : vPor.binding_profile.entrySet()) { - jGen.writeStringField(entry.getKey().toString().toLowerCase(), entry.getValue().toString()); + jGen.writeStringField(entry.getKey().toLowerCase(), entry.getValue()); } } jGen.writeEndObject(); @@ -39,7 +39,7 @@ public void serialize(VirtualPort vPor, JsonGenerator jGen, SerializerProvider s for (Map fiMap : vPor.fixed_ips) { jGen.writeStartObject(); for (Entry entry : fiMap.entrySet()) { - jGen.writeStringField(entry.getKey().toString().toLowerCase(), entry.getValue().toString()); + jGen.writeStringField(entry.getKey().toLowerCase(), entry.getValue()); } jGen.writeEndObject(); } @@ -48,7 +48,7 @@ public void serialize(VirtualPort vPor, JsonGenerator jGen, SerializerProvider s jGen.writeArrayFieldStart("security_groups"); for (Map sgMap : vPor.security_groups) { for (Entry entry : sgMap.entrySet()) { - if("id".equals(entry.getKey().toString().toLowerCase())) { + if("id".equals(entry.getKey().toLowerCase())) { jGen.writeString(entry.getValue().toString()); } } @@ -65,7 +65,7 @@ public void serialize(VirtualPort vPor, JsonGenerator jGen, SerializerProvider s jGen.writeObjectFieldStart("binding_vif_details"); if(vPor.binding_vif_details != null) { for (Entry entry : vPor.binding_vif_details.entrySet()) { - jGen.writeStringField(entry.getKey().toString().toLowerCase(), entry.getValue().toString()); + jGen.writeStringField(entry.getKey().toLowerCase(), entry.getValue()); } } jGen.writeEndObject(); } diff --git a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualSubnet.java b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualSubnet.java index f6d5087e..596ab8a8 100644 --- a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualSubnet.java +++ b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualSubnet.java @@ -45,8 +45,6 @@ public VirtualSubnet(SubnetDefinition subnet) { this.ipv6_ra_mode = subnet.ipv6_ra_mode; this.ipv6_address_mode = subnet.ipv6_address_mode; this.shared = subnet.shared; - - return; } /** @@ -55,7 +53,6 @@ public VirtualSubnet(SubnetDefinition subnet) { */ public void setSubName(String subName){ this.subName = subName; - return; } /** @@ -64,7 +61,6 @@ public void setSubName(String subName){ */ public void setEnableDhcp(String enable_dhcp){ this.enable_dhcp = enable_dhcp; - return; } /** @@ -73,7 +69,6 @@ public void setEnableDhcp(String enable_dhcp){ */ public void setGatewayIp(String gateway_ip){ this.gateway_ip = gateway_ip; - return; } /** @@ -82,7 +77,6 @@ public void setGatewayIp(String gateway_ip){ */ public void setShared(String shared){ this.shared = shared; - return; } /** @@ -91,7 +85,6 @@ public void setShared(String shared){ */ public void setDnsNameservers(List dns_nameservers){ this.dns_nameservers = dns_nameservers; - return; } /** @@ -100,7 +93,6 @@ public void setDnsNameservers(List dns_nameservers){ */ public void setHostRoutes(List host_routes){ this.host_routes = host_routes; - return; } /** @@ -109,7 +101,6 @@ public void setHostRoutes(List host_routes){ */ public void setIpv6RaMode(String ipv6_ra_mode){ this.ipv6_ra_mode = ipv6_ra_mode; - return; } /** @@ -118,7 +109,6 @@ public void setIpv6RaMode(String ipv6_ra_mode){ */ public void setIpv6AddressMode(String ipv6_address_mode){ this.ipv6_address_mode = ipv6_address_mode; - return; } } diff --git a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualSubnetSerializer.java b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualSubnetSerializer.java index 4427a803..82ba0c3c 100644 --- a/Torpedo/src/etri/sdn/controller/module/ml2/VirtualSubnetSerializer.java +++ b/Torpedo/src/etri/sdn/controller/module/ml2/VirtualSubnetSerializer.java @@ -12,7 +12,7 @@ public class VirtualSubnetSerializer extends JsonSerializer { @Override - public void serialize(VirtualSubnet vSub, JsonGenerator jGen, SerializerProvider serializer) throws IOException, JsonProcessingException { + public void serialize(VirtualSubnet vSub, JsonGenerator jGen, SerializerProvider serializer) throws IOException { jGen.writeStartObject(); jGen.writeStringField("name", vSub.subName); jGen.writeStringField("enable_dhcp", vSub.enable_dhcp); @@ -29,7 +29,7 @@ public void serialize(VirtualSubnet vSub, JsonGenerator jGen, SerializerProvider for (Map apMap : vSub.allocation_pools) { jGen.writeStartObject(); for (Entry entry : apMap.entrySet()) { - jGen.writeStringField(entry.getKey().toString().toLowerCase(), entry.getValue().toString()); + jGen.writeStringField(entry.getKey().toLowerCase(), entry.getValue()); } jGen.writeEndObject(); } diff --git a/Torpedo/src/etri/sdn/controller/module/statemanager/RESTFeaturesApi.java b/Torpedo/src/etri/sdn/controller/module/statemanager/RESTFeaturesApi.java index 9ddbfed4..4f8eba61 100644 --- a/Torpedo/src/etri/sdn/controller/module/statemanager/RESTFeaturesApi.java +++ b/Torpedo/src/etri/sdn/controller/module/statemanager/RESTFeaturesApi.java @@ -77,7 +77,6 @@ private void sendReply(Object result, Response response) { response.setEntity(r, MediaType.APPLICATION_JSON); } catch (Exception e) { OFMStateManager.logger.error("error={}", StackTrace.of(e)); - return; } } diff --git a/Torpedo/src/etri/sdn/controller/module/statemanager/State.java b/Torpedo/src/etri/sdn/controller/module/statemanager/State.java index 949fb46d..351179c9 100644 --- a/Torpedo/src/etri/sdn/controller/module/statemanager/State.java +++ b/Torpedo/src/etri/sdn/controller/module/statemanager/State.java @@ -82,7 +82,7 @@ public State(OFMStateManager manager) { this.timeInitiated = Calendar.getInstance().getTimeInMillis(); this.totalMemory = Runtime.getRuntime().totalMemory(); - this.protocol = (OFProtocol) manager.getController().getProtocol(); + this.protocol = manager.getController().getProtocol(); this.features_reply_module = new OFFeaturesReplySerializerModule(this.protocol); initRestApis(); diff --git a/Torpedo/src/etri/sdn/controller/module/staticentrymanager/RESTListApi.java b/Torpedo/src/etri/sdn/controller/module/staticentrymanager/RESTListApi.java index 3a248c5f..3615ebd9 100644 --- a/Torpedo/src/etri/sdn/controller/module/staticentrymanager/RESTListApi.java +++ b/Torpedo/src/etri/sdn/controller/module/staticentrymanager/RESTListApi.java @@ -37,10 +37,8 @@ public void handle(Request request, Response response) { try { String r = om.writeValueAsString(manager.getStaticFlowEntryStorage().getFlowModMap(sw)); response.setEntity(r, MediaType.APPLICATION_JSON); - return; } catch ( Exception e ) { e.printStackTrace(); - return; } } } diff --git a/Torpedo/src/etri/sdn/controller/module/staticentrymanager/StaticFlowEntry.java b/Torpedo/src/etri/sdn/controller/module/staticentrymanager/StaticFlowEntry.java index c0490525..775e6f7d 100644 --- a/Torpedo/src/etri/sdn/controller/module/staticentrymanager/StaticFlowEntry.java +++ b/Torpedo/src/etri/sdn/controller/module/staticentrymanager/StaticFlowEntry.java @@ -805,7 +805,7 @@ else if (key.toLowerCase().equals("instructions")) { throw new StaticFlowEntryException("skipping entry " + entryName + " on switch " + switchName + " with bad data: " + e.getMessage()); } else { - throw new StaticFlowEntryException("skipping entry with bad data: " + e.getMessage() + " :: " + e.getStackTrace()); + throw new StaticFlowEntryException(String.format("skipping entry with bad data: %s :: %s", e.getMessage(), e.getStackTrace())); } } @@ -960,13 +960,13 @@ public static Map jsonToStaticFlowEntry(String jsontext) throws Map.Entry field = fields.next(); if (field.getKey() == "instructions") { - entry.put(field.getKey().toString(), jsonToInstructions(field.getValue().toString())); + entry.put(field.getKey(), jsonToInstructions(field.getValue().toString())); } else if (field.getKey() == "actions") { - entry.put(field.getKey().toString(), jsonToActions(field.getValue().toString())); + entry.put(field.getKey(), jsonToActions(field.getValue().toString())); } else { - entry.put(field.getKey().toString(), field.getValue().toString().replaceAll("\"", "")); + entry.put(field.getKey(), field.getValue().toString().replaceAll("\"", "")); } } diff --git a/Torpedo/src/etri/sdn/controller/module/storagemanager/OFMStorageManager.java b/Torpedo/src/etri/sdn/controller/module/storagemanager/OFMStorageManager.java index 345cbb0c..a97a99d4 100644 --- a/Torpedo/src/etri/sdn/controller/module/storagemanager/OFMStorageManager.java +++ b/Torpedo/src/etri/sdn/controller/module/storagemanager/OFMStorageManager.java @@ -133,7 +133,7 @@ public boolean insert(String dbName, String collection, Map quer logger.debug("inserted successfully."); } else { logger.info("error occur during inserting procedure."); - return isInserted == null; + return false; } } return true; @@ -413,7 +413,8 @@ public boolean upsert(String dbName, String collection, Map key, } catch(Exception e) { logger.error("upsertion erorr ={} ", e); } - Object isInserted = result.getField("err"); + assert result != null; + Object isInserted = result.getField("err"); if(isInserted == null) { logger.debug("upserted successful."); return true; @@ -662,7 +663,7 @@ public void ensureIndex(String dbName, String collection, Map ke this.db = this.mongoClient.getDB(dbName); Map unique = new HashMap(); - unique.put("unique", (boolean)true); + unique.put("unique", true); BasicDBObject dbObject1 = new BasicDBObject(key); BasicDBObject dbObject2 = new BasicDBObject(unique); diff --git a/Torpedo/src/etri/sdn/controller/module/storagemanager/Storage.java b/Torpedo/src/etri/sdn/controller/module/storagemanager/Storage.java index 27be5a30..9c51504b 100644 --- a/Torpedo/src/etri/sdn/controller/module/storagemanager/Storage.java +++ b/Torpedo/src/etri/sdn/controller/module/storagemanager/Storage.java @@ -140,7 +140,7 @@ public void handle(Request request, Response response) { e.printStackTrace(); } - storageInstance.insert(dbName, collection, (Map)map); + storageInstance.insert(dbName, collection, map); response.setEntity(r, MediaType.APPLICATION_JSON); } catch (StorageException e) { logger.error(INSERTING_ERROR_MESSAGE + e); @@ -261,10 +261,10 @@ public void handle(Request request, Response response) { return; } - storageInstance.delete(dbName, collection, (Map)map); + storageInstance.delete(dbName, collection, map); response.setEntity(query, MediaType.APPLICATION_JSON); } catch (StorageException e) { - logger.error(DELETING_ERROR_MESSAGE + e);; + logger.error(DELETING_ERROR_MESSAGE + e); } } } @@ -328,7 +328,7 @@ public void handle(Request request, Response response) { return; } - List> list = storageInstance.retrieve(dbName, collection, (Map)map); + List> list = storageInstance.retrieve(dbName, collection, map); ObjectMapper om = new ObjectMapper(); String r = null; try { diff --git a/Torpedo/src/etri/sdn/controller/module/storagemanager/StorageConverter.java b/Torpedo/src/etri/sdn/controller/module/storagemanager/StorageConverter.java index d2a680cc..0b2ef8a2 100644 --- a/Torpedo/src/etri/sdn/controller/module/storagemanager/StorageConverter.java +++ b/Torpedo/src/etri/sdn/controller/module/storagemanager/StorageConverter.java @@ -58,9 +58,8 @@ public static BasicDBObject MapToDBObject(Map map) { */ @SuppressWarnings("unchecked") public static Map DBObjectToMap(BasicDBObject dbObject) { - Map map = (Map) jsonTraverse(dbObject.toMap(), false); - return map; + return (Map) jsonTraverse(dbObject.toMap(), false); } /** diff --git a/Torpedo/src/etri/sdn/controller/module/topologymanager/OFMTopologyManager.java b/Torpedo/src/etri/sdn/controller/module/topologymanager/OFMTopologyManager.java index 0c1b7874..11c4a0c0 100644 --- a/Torpedo/src/etri/sdn/controller/module/topologymanager/OFMTopologyManager.java +++ b/Torpedo/src/etri/sdn/controller/module/topologymanager/OFMTopologyManager.java @@ -146,7 +146,7 @@ public void initialize() { linkDiscovery = (ILinkDiscoveryService) getModule(ILinkDiscoveryService.class); linkDiscovery.addListener(this); - protocol = (OFProtocol) getController().getProtocol(); + protocol = getController().getProtocol(); // I will receive all PACKET_IN messages. registerFilter( diff --git a/Torpedo/src/etri/sdn/controller/module/topologymanager/Topology.java b/Torpedo/src/etri/sdn/controller/module/topologymanager/Topology.java index ac690c09..6286ef67 100644 --- a/Torpedo/src/etri/sdn/controller/module/topologymanager/Topology.java +++ b/Torpedo/src/etri/sdn/controller/module/topologymanager/Topology.java @@ -56,7 +56,6 @@ private void reply(Object code, Response response) { response.setEntity(r, MediaType.APPLICATION_JSON); } catch (Exception e) { OFMTopologyManager.logger.error("error={}", StackTrace.of(e)); - return; } } diff --git a/Torpedo/src/etri/sdn/controller/module/topologymanager/TopologyInstance.java b/Torpedo/src/etri/sdn/controller/module/topologymanager/TopologyInstance.java index c8fc8876..dc14961a 100644 --- a/Torpedo/src/etri/sdn/controller/module/topologymanager/TopologyInstance.java +++ b/Torpedo/src/etri/sdn/controller/module/topologymanager/TopologyInstance.java @@ -493,8 +493,7 @@ protected BroadcastTree dijkstra(Cluster c, Long root, } } - BroadcastTree ret = new BroadcastTree(nexthoplinks, cost); - return ret; + return new BroadcastTree(nexthoplinks, cost); } protected void calculateShortestPathTreeInClusters() { diff --git a/Torpedo/src/etri/sdn/controller/protocol/OFProtocol.java b/Torpedo/src/etri/sdn/controller/protocol/OFProtocol.java index 5d79a14f..39f53b49 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/OFProtocol.java +++ b/Torpedo/src/etri/sdn/controller/protocol/OFProtocol.java @@ -496,7 +496,7 @@ public boolean process(Connection conn, MessageContext context, OFMessage m) { if ( sw == null ) return false; OFPortStatus ps = (OFPortStatus) m; - OFPortDesc phyport = (OFPortDesc) ps.getDesc(); + OFPortDesc phyport = ps.getDesc(); if ( ps.getReason() == OFPortReason.DELETE ) { removePortInformation( sw, phyport ); } else if ( ps.getReason() == OFPortReason.MODIFY ) { diff --git a/Torpedo/src/etri/sdn/controller/protocol/io/Connection.java b/Torpedo/src/etri/sdn/controller/protocol/io/Connection.java index 7659603c..1084ebe4 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/io/Connection.java +++ b/Torpedo/src/etri/sdn/controller/protocol/io/Connection.java @@ -15,7 +15,7 @@ import org.projectfloodlight.openflow.protocol.OFMessage; public final class Connection { - public enum STATUS { CONNECTED, RUNNING, CLOSED }; + public enum STATUS { CONNECTED, RUNNING, CLOSED } private static int SEQ = 0; @@ -238,7 +238,6 @@ private void markToWrite() { } catch ( NullPointerException e ) { // this is a truly exceptional case that there is no key // bounded for the client. (connection is already cut.) - return; } } @@ -253,7 +252,6 @@ private void markFlushed() { } catch ( NullPointerException e ) { // this is a truly exceptional case that there is no key // bounded for the client. (connection is already cut.) - return; } } } diff --git a/Torpedo/src/etri/sdn/controller/protocol/io/IOFHandler.java b/Torpedo/src/etri/sdn/controller/protocol/io/IOFHandler.java index 731b84bd..9f82d1c6 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/io/IOFHandler.java +++ b/Torpedo/src/etri/sdn/controller/protocol/io/IOFHandler.java @@ -22,7 +22,7 @@ public interface IOFHandler { * The role of the controller as used by the OF 1.2 and OVS failover and * load-balancing mechanism. */ - public static enum Role { EQUAL, MASTER, SLAVE }; + public static enum Role { EQUAL, MASTER, SLAVE } /** * Get the current role of the controller diff --git a/Torpedo/src/etri/sdn/controller/protocol/io/IOFSwitch.java b/Torpedo/src/etri/sdn/controller/protocol/io/IOFSwitch.java index 45346e9c..2034205b 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/io/IOFSwitch.java +++ b/Torpedo/src/etri/sdn/controller/protocol/io/IOFSwitch.java @@ -36,7 +36,7 @@ public interface IOFSwitch { public enum SwitchType { BASIC_SWITCH, CORE_SWITCH - }; + } // Attribute keys public static final String SWITCH_DESCRIPTION_FUTURE = "DescriptionFuture"; diff --git a/Torpedo/src/etri/sdn/controller/protocol/io/OFSwitchImpl.java b/Torpedo/src/etri/sdn/controller/protocol/io/OFSwitchImpl.java index b6ebd515..cdc3475c 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/io/OFSwitchImpl.java +++ b/Torpedo/src/etri/sdn/controller/protocol/io/OFSwitchImpl.java @@ -125,7 +125,6 @@ public Object getAttribute(String name) { @Override public void setAttribute(String name, Object value) { this.attributes.put(name, value); - return; } @Override diff --git a/Torpedo/src/etri/sdn/controller/protocol/io/TcpServer.java b/Torpedo/src/etri/sdn/controller/protocol/io/TcpServer.java index 5293cc57..38b1e87e 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/io/TcpServer.java +++ b/Torpedo/src/etri/sdn/controller/protocol/io/TcpServer.java @@ -107,7 +107,6 @@ public void run() { } catch (IOException e) { e.printStackTrace(); // cannot do further processing. - return; } } } diff --git a/Torpedo/src/etri/sdn/controller/protocol/packet/ARP.java b/Torpedo/src/etri/sdn/controller/protocol/packet/ARP.java index 457d6be3..84df423c 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/packet/ARP.java +++ b/Torpedo/src/etri/sdn/controller/protocol/packet/ARP.java @@ -27,12 +27,12 @@ public class ARP extends BasePacket { public static short HW_TYPE_ETHERNET = 0x1; - public static short PROTO_TYPE_IP = 0x800; + public static final short PROTO_TYPE_IP = 0x800; - public static short OP_REQUEST = 0x1; - public static short OP_REPLY = 0x2; - public static short OP_RARP_REQUEST = 0x3; - public static short OP_RARP_REPLY = 0x4; + public static final short OP_REQUEST = 0x1; + public static final short OP_REPLY = 0x2; + public static final short OP_RARP_REQUEST = 0x3; + public static final short OP_RARP_REPLY = 0x4; protected short hardwareType; protected short protocolType; diff --git a/Torpedo/src/etri/sdn/controller/protocol/packet/BPDU.java b/Torpedo/src/etri/sdn/controller/protocol/packet/BPDU.java index a37955b7..41283a4c 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/packet/BPDU.java +++ b/Torpedo/src/etri/sdn/controller/protocol/packet/BPDU.java @@ -27,7 +27,7 @@ public class BPDU extends BasePacket { public enum BPDUType { CONFIG, - TOPOLOGY_CHANGE; + TOPOLOGY_CHANGE, } private final long destMac = 0x0180c2000000L; // 01-80-c2-00-00-00 diff --git a/Torpedo/src/etri/sdn/controller/protocol/packet/DHCP.java b/Torpedo/src/etri/sdn/controller/protocol/packet/DHCP.java index 2515740f..643beb1b 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/packet/DHCP.java +++ b/Torpedo/src/etri/sdn/controller/protocol/packet/DHCP.java @@ -55,9 +55,9 @@ public class DHCP extends BasePacket { * */ // Header + magic without options - public static int MIN_HEADER_LENGTH = 240; - public static byte OPCODE_REQUEST = 0x1; - public static byte OPCODE_REPLY = 0x2; + public static final int MIN_HEADER_LENGTH = 240; + public static final byte OPCODE_REQUEST = 0x1; + public static final byte OPCODE_REPLY = 0x2; public static byte HWTYPE_ETHERNET = 0x1; diff --git a/Torpedo/src/etri/sdn/controller/protocol/packet/Ethernet.java b/Torpedo/src/etri/sdn/controller/protocol/packet/Ethernet.java index 63e0bb32..79e0d9c5 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/packet/Ethernet.java +++ b/Torpedo/src/etri/sdn/controller/protocol/packet/Ethernet.java @@ -372,7 +372,7 @@ public String toString() { StringBuffer sb = new StringBuffer("\n"); - IPacket pkt = (IPacket) this.getPayload(); + IPacket pkt = this.getPayload(); if (pkt instanceof ARP) sb.append("arp"); diff --git a/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/ModuleListSerializerModule.java b/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/ModuleListSerializerModule.java index 49d1f211..d1c6aabf 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/ModuleListSerializerModule.java +++ b/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/ModuleListSerializerModule.java @@ -27,7 +27,7 @@ class ModuleSerializer extends JsonSerializer { @Override public void serialize(OFModule module, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + throws IOException { Collection modules = module.getController().getModules(); jgen.writeStartObject(); jgen.writeBooleanField("loaded", true); @@ -78,7 +78,7 @@ else if (intf.getName().endsWith("Listener")) { class ModuleListSerializer extends JsonSerializer { @Override public void serialize(OFController controller, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + throws IOException { jgen.writeStartObject(); for (OFModule m : controller.getModules()) { diff --git a/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFFeaturesReplySerializerModule.java b/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFFeaturesReplySerializerModule.java index 5f433c74..61fe039c 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFFeaturesReplySerializerModule.java +++ b/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFFeaturesReplySerializerModule.java @@ -28,7 +28,7 @@ public OFFeaturesReplySerializer(OFProtocol protocol) { } @Override public void serialize(OFFeaturesReply reply, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + throws IOException { jgen.writeStartObject(); jgen.writeStringField("datapathId", reply.getDatapathId().toString()); @@ -64,12 +64,12 @@ final class OFPhysicalPortSerializer extends JsonSerializer { @Override // public void serialize(OFPhysicalPort port, JsonGenerator jgen, SerializerProvider provider) public void serialize(OFPortDesc port, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + throws IOException { jgen.writeStartObject(); jgen.writeNumberField("portNumber", port.getPortNo().getPortNumber()); jgen.writeStringField("hardwareAddress", port.getHwAddr().toString()); - jgen.writeStringField("name", new String(port.getName())); + jgen.writeStringField("name", port.getName()); jgen.writeStringField("config", port.getConfig().toString()); jgen.writeStringField("state", port.getState().toString()); jgen.writeStringField("currentFeatures", port.getCurr().toString()); diff --git a/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFFlowStatisticsReplySerializerModule.java b/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFFlowStatisticsReplySerializerModule.java index b187c435..e0b78f6c 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFFlowStatisticsReplySerializerModule.java +++ b/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFFlowStatisticsReplySerializerModule.java @@ -14,7 +14,7 @@ final class OFFlowStatsEntrySerializer extends JsonSerializer @Override public void serialize(OFFlowStatsEntry entry, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + throws IOException { jgen.writeStartObject(); jgen.writeNumberField("tableId", entry.getTableId().getValue()); provider.defaultSerializeField("match", entry.getMatch(), jgen); diff --git a/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFTypeSerializerModule.java b/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFTypeSerializerModule.java index 8b00c0aa..bebec8c5 100644 --- a/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFTypeSerializerModule.java +++ b/Torpedo/src/etri/sdn/controller/protocol/rest/serializer/OFTypeSerializerModule.java @@ -33,8 +33,8 @@ final class OFMatchSerializer extends JsonSerializer { * @param provider SerializerProvider object. not used. */ @Override - public void serialize(Match match, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + public void serialize(Match match, JsonGenerator jgen, SerializerProvider provider) + throws IOException { jgen.writeStartObject(); for ( MatchField mf: match.getMatchFields() ) { @@ -59,7 +59,7 @@ public void serialize(Match match, JsonGenerator jgen, SerializerProvider provid final class OFOxmSerializer extends JsonSerializer { @Override public void serialize(OFOxm oxm, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + throws IOException { jgen.writeStartObject(); jgen.writeStringField(oxm.getMatchField().getName(), oxm.getValue().toString()); if ( oxm.isMasked() ) { @@ -78,7 +78,7 @@ public void serialize(OFOxm oxm, JsonGenerator jgen, SerializerProvider provider final class OFPortSerializer extends JsonSerializer { @Override public void serialize(OFPort reply, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + throws IOException { jgen.writeNumber(reply.getPortNumber()); } } @@ -86,7 +86,7 @@ public void serialize(OFPort reply, JsonGenerator jgen, SerializerProvider provi final class U64Serializer extends JsonSerializer { @Override public void serialize(U64 val, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { + throws IOException { jgen.writeNumber(val.getValue()); } } @@ -94,8 +94,7 @@ public void serialize(U64 val, JsonGenerator jgen, SerializerProvider provider) final class ArpOpcodeSerializer extends JsonSerializer { @Override - public void serialize(ArpOpcode val, JsonGenerator jgen, SerializerProvider provider) throws IOException, - JsonProcessingException { + public void serialize(ArpOpcode val, JsonGenerator jgen, SerializerProvider provider) throws IOException { // TODO Auto-generated method stub jgen.writeString(val.toString()); } diff --git a/Torpedo/src/etri/sdn/controller/util/JarLoader.java b/Torpedo/src/etri/sdn/controller/util/JarLoader.java index e0557e5a..8bf94302 100644 --- a/Torpedo/src/etri/sdn/controller/util/JarLoader.java +++ b/Torpedo/src/etri/sdn/controller/util/JarLoader.java @@ -53,7 +53,7 @@ public static OFController getController(String path, int num_of_instances, Stri try { Constructor constructor = - ctrl.getConstructor(new Class[]{ int.class, String.class }); + ctrl.getConstructor(int.class, String.class); return constructor.newInstance( num_of_instances, role ); } catch (NoSuchMethodException e) { logger.error("Cannot find constructor for " + path); diff --git a/Torpedo/src/org/openflow/io/SocketWriteByteChannelBuffer.java b/Torpedo/src/org/openflow/io/SocketWriteByteChannelBuffer.java index f81e0e8b..57fc44f7 100644 --- a/Torpedo/src/org/openflow/io/SocketWriteByteChannelBuffer.java +++ b/Torpedo/src/org/openflow/io/SocketWriteByteChannelBuffer.java @@ -496,7 +496,7 @@ public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) { } for ( int i = 0; i < length; ++i ) { - this.outBuf.put(index+i, (byte)src.getByte(srcIndex+i)); + this.outBuf.put(index+i, src.getByte(srcIndex+i)); } } diff --git a/Torpedo/web/index.html b/Torpedo/web/index.html index 7d1801bc..193b45cd 100644 --- a/Torpedo/web/index.html +++ b/Torpedo/web/index.html @@ -109,7 +109,7 @@

Switches({{switches.length}})

{{switch.vendor}} {{switch.packets}} {{switch.bytes}} - {{switch.flows}} + {{switch.flows}} {{switch.connectedSince}} @@ -239,11 +239,13 @@

vPorts({{vPorts.length}})