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 { ...@@ -112,10 +112,10 @@ public final class OpticalPortOperator implements ConfigOperator {
112 return new OduCltPortDescription(port, odu.isEnabled(), odu.signalType(), sa); 112 return new OduCltPortDescription(port, odu.isEnabled(), odu.signalType(), sa);
113 case PACKET: 113 case PACKET:
114 case FIBER: 114 case FIBER:
115 + case COPPER:
115 return new DefaultPortDescription(port, descr.isEnabled(), descr.type(), 116 return new DefaultPortDescription(port, descr.isEnabled(), descr.type(),
116 descr.portSpeed(), sa); 117 descr.portSpeed(), sa);
117 default: 118 default:
118 - // this includes copper ports.
119 log.warn("Unsupported optical port type {} - can't update", descr.type()); 119 log.warn("Unsupported optical port type {} - can't update", descr.type());
120 return descr; 120 return descr;
121 } 121 }
......
...@@ -344,7 +344,10 @@ class LINCSwitch(OpticalSwitch): ...@@ -344,7 +344,10 @@ class LINCSwitch(OpticalSwitch):
344 continue 344 continue
345 portDict = {} 345 portDict = {}
346 portDict[ 'port' ] = port 346 portDict[ 'port' ] = port
347 - portDict[ 'type' ] = 'FIBER' if isinstance(intf.link, LINCLink) else 'COPPER' 347 + portType = 'COPPER'
348 + if isinstance(intf.link, LINCLink):
349 + portType = 'OCH' if intf.link.isCrossConnect else 'OMS'
350 + portDict[ 'type' ] = portType
348 intfList = [ intf.link.intf1, intf.link.intf2 ] 351 intfList = [ intf.link.intf1, intf.link.intf2 ]
349 intfList.remove(intf) 352 intfList.remove(intf)
350 portDict[ 'speed' ] = intfList[ 0 ].speed if isinstance(intf.link, LINCLink) else 0 353 portDict[ 'speed' ] = intfList[ 0 ].speed if isinstance(intf.link, LINCLink) else 0
...@@ -787,7 +790,10 @@ class LINCIntf(OpticalIntf): ...@@ -787,7 +790,10 @@ class LINCIntf(OpticalIntf):
787 configDict = {} 790 configDict = {}
788 configDict[ 'port' ] = self.port 791 configDict[ 'port' ] = self.port
789 configDict[ 'speed' ] = self.speed 792 configDict[ 'speed' ] = self.speed
790 - configDict[ 'type' ] = 'FIBER' 793 + portType = 'COPPER'
794 + if isinstance(self.link, LINCLink):
795 + portType = 'OCH' if self.link.isCrossConnect else 'OMS'
796 + configDict[ 'type' ] = portType
791 return configDict 797 return configDict
792 798
793 def config(self, *args, **kwargs): 799 def config(self, *args, **kwargs):
......