Ayaka Koshibe
Committed by Yuta HIGUCHI

opticalUtils advertises correct port types

This should proactively prevent linc-OE from misbehaving if support for changing
port type through the network config system is added.

Change-Id: I80667f0292922eca37a51f3e461b6745ecbf9d46
......@@ -112,10 +112,10 @@ public final class OpticalPortOperator implements ConfigOperator {
return new OduCltPortDescription(port, odu.isEnabled(), odu.signalType(), sa);
case PACKET:
case FIBER:
case COPPER:
return new DefaultPortDescription(port, descr.isEnabled(), descr.type(),
descr.portSpeed(), sa);
default:
// this includes copper ports.
log.warn("Unsupported optical port type {} - can't update", descr.type());
return descr;
}
......
......@@ -344,7 +344,10 @@ class LINCSwitch(OpticalSwitch):
continue
portDict = {}
portDict[ 'port' ] = port
portDict[ 'type' ] = 'FIBER' if isinstance(intf.link, LINCLink) else 'COPPER'
portType = 'COPPER'
if isinstance(intf.link, LINCLink):
portType = 'OCH' if intf.link.isCrossConnect else 'OMS'
portDict[ 'type' ] = portType
intfList = [ intf.link.intf1, intf.link.intf2 ]
intfList.remove(intf)
portDict[ 'speed' ] = intfList[ 0 ].speed if isinstance(intf.link, LINCLink) else 0
......@@ -787,7 +790,10 @@ class LINCIntf(OpticalIntf):
configDict = {}
configDict[ 'port' ] = self.port
configDict[ 'speed' ] = self.speed
configDict[ 'type' ] = 'FIBER'
portType = 'COPPER'
if isinstance(self.link, LINCLink):
portType = 'OCH' if self.link.isCrossConnect else 'OMS'
configDict[ 'type' ] = portType
return configDict
def config(self, *args, **kwargs):
......