use of org.projectfloodlight.openflow.protocol.OFPortConfig in project open-kilda by telstra.
the class SwitchManager method updatePortStatus.
private void updatePortStatus(IOFSwitch sw, int portNumber, boolean isAdminDown) throws SwitchOperationException {
Set<OFPortConfig> config = new HashSet<>(1);
if (isAdminDown) {
config.add(OFPortConfig.PORT_DOWN);
}
Set<OFPortConfig> portMask = ImmutableSet.of(OFPortConfig.PORT_DOWN);
final OFFactory ofFactory = sw.getOFFactory();
OFPortMod ofPortMod = ofFactory.buildPortMod().setPortNo(OFPort.of(portNumber)).setHwAddr(getPortHwAddress(sw, portNumber)).setConfig(config).setMask(portMask).build();
if (!sw.write(ofPortMod)) {
throw new SwitchOperationException(sw.getId(), format("Unable to update port configuration: %s", ofPortMod));
}
logger.debug("Successfully updated port status {}", ofPortMod);
}
Aggregations