+
+ public static def toADNodeConnectorProperties(NodeConnectorUpdated nc) {
+ val props = new java.util.HashSet<org.opendaylight.controller.sal.core.Property>();
+ val fcncu = nc.getAugmentation(FlowCapableNodeConnectorUpdated)
+ if(fcncu != null) {
+ if(fcncu.currentFeature != null && fcncu.currentFeature.toAdBandwidth != null) {
+ props.add(fcncu.currentFeature.toAdBandwidth)
+ }
+ if(fcncu.advertisedFeatures != null && fcncu.advertisedFeatures.toAdAdvertizedBandwidth != null) {
+ props.add(fcncu.advertisedFeatures.toAdAdvertizedBandwidth)
+ }
+ if(fcncu.supported != null && fcncu.supported.toAdSupportedBandwidth != null) {
+ props.add(fcncu.supported.toAdSupportedBandwidth)
+ }
+ if(fcncu.peerFeatures != null && fcncu.peerFeatures.toAdPeerBandwidth != null) {
+ props.add(fcncu.peerFeatures.toAdPeerBandwidth)
+ }
+ if(fcncu.name != null && fcncu.name.toAdName != null) {
+ props.add(fcncu.name.toAdName)
+ }
+ if(fcncu.configuration != null && fcncu.configuration.toAdConfig != null) {
+ props.add(fcncu.configuration.toAdConfig)
+ }
+ if(fcncu.state != null && fcncu.state.toAdState != null) {
+ props.add(fcncu.state.toAdState)
+ }
+ }
+ return props
+ }
+
+ public static def toAdName(String name) {
+ return new Name(name)
+ }
+
+ public static def toAdConfig(PortConfig pc) {
+ var Config config;
+ if(pc.PORTDOWN){
+ config = new Config(Config.ADMIN_DOWN)
+ } else {
+ config = new Config(Config.ADMIN_UP)
+ }
+ return config
+ }
+
+ public static def toAdState(State s) {
+ var org.opendaylight.controller.sal.core.State state
+ if(s.linkDown) {
+ state = new org.opendaylight.controller.sal.core.State(org.opendaylight.controller.sal.core.State.EDGE_DOWN)
+ } else {
+ state = new org.opendaylight.controller.sal.core.State(org.opendaylight.controller.sal.core.State.EDGE_UP)
+ }
+ return state
+ }
+
+ public static def toAdBandwidth(PortFeatures pf) {
+ var Bandwidth bw = null
+ if (pf.is_10mbHd || pf.is_10mbFd ) {
+ bw= new Bandwidth(Bandwidth.BW10Mbps)
+ } else if (pf.is_100mbHd || pf.is_100mbFd ) {
+ bw= new Bandwidth(Bandwidth.BW100Mbps)
+ } else if (pf.is_1gbHd || pf.is_1gbFd ) {
+ bw= new Bandwidth(Bandwidth.BW1Gbps)
+ } else if (pf.is_1gbFd ) {
+ bw= new Bandwidth(Bandwidth.BW10Gbps)
+ } else if ( pf.is_10gbFd ) {
+ bw= new Bandwidth(Bandwidth.BW10Gbps)
+ } else if ( pf.is_40gbFd ) {
+ bw= new Bandwidth(Bandwidth.BW40Gbps)
+ } else if ( pf.is_100gbFd ) {
+ bw= new Bandwidth(Bandwidth.BW100Gbps)
+ } else if ( pf.is_1tbFd ) {
+ bw= new Bandwidth(Bandwidth.BW1Tbps)
+ }
+ return bw;
+ }
+
+ public static def toAdAdvertizedBandwidth(PortFeatures pf) {
+ var AdvertisedBandwidth abw
+ val bw = pf.toAdBandwidth
+ if(bw != null) {
+ abw = new AdvertisedBandwidth(bw.value)
+ }
+ return abw
+ }
+
+ public static def toAdSupportedBandwidth(PortFeatures pf) {
+ var SupportedBandwidth sbw
+ val bw = pf.toAdBandwidth
+ if(bw != null ) {
+ sbw = new SupportedBandwidth(bw.value)
+ }
+ return sbw
+ }
+
+ public static def toAdPeerBandwidth(PortFeatures pf) {
+ var PeerBandwidth pbw
+ val bw = pf.toAdBandwidth
+ if(bw != null) {
+ pbw = new PeerBandwidth(bw.value)
+ }
+ return pbw
+ }
+
+