boolean isBlocked = false; // (1),
boolean isLive = false; // (2);
- if (state.getIntValue() == 0) {
+ if (state.isLinkDown()) {
isLinkDown = true;
- } else if (state.getIntValue() == 1) {
+ } else if (state.isBlocked()) {
isBlocked = true;
- } else if (state.getIntValue() == 2) {
+ } else if (state.isLive()) {
isLive = true;
}
portState = new PortState(isLinkDown, isBlocked, isLive);
ncb.addAugmentation(FlowCapableNodeConnector.class, fcncb.build());
PortState portState = flowConnector.getState();
PortConfig portConfig = flowConnector.getConfiguration();
- if((portState ==null || !portState.equals(PortState.LinkDown)) && (portConfig == null || !portConfig.isPORTDOWN())) {
+ if((portState ==null || !portState.isLinkDown()) && (portConfig == null || !portConfig.isPORTDOWN())) {
LLDPSpeaker.getInstance().addNodeConnector(nodeConnectorInstanceId,ncb.build());
} else {
LLDPSpeaker.getInstance().removeNodeConnector(nodeConnectorInstanceId,ncb.build());
package org.opendaylight.openflowplugin.openflow.md.util;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.State;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.StateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;
return napf;
}
- public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortState translatePortState(PortState state) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortState nstate = null;
- if(state != null) {
- if(state.isBlocked()) {
- nstate = org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortState.Blocked;
- } else if (state.isLinkDown()) {
- nstate = org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortState.LinkDown;
- } else if (state.isLive()) {
- nstate = org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortState.Live;
- }
+ public static State translatePortState(PortState state) {
+ StateBuilder nstate = new StateBuilder();
+ if(state !=null) {
+ nstate.setBlocked(state.isBlocked());
+ nstate.setLinkDown(state.isLinkDown());
+ nstate.setLive(state.isLive());
}
- return nstate;
+ return nstate.build();
}
public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig translatePortConfig(PortConfig pc) {