private double start;
private double stop;
private double wavelength;
+ // wavelengthSpacing is in GHz
+ float wavelengthSpacing = 50;
+ // beginWavelength is in nm: f or F is appended to treat it explicitly as simple float (and not double float)
+ final float beginWavelength = 1528.77f;
+ // java double is double float - d or D is appended to treat it explicitly as double float
+ final double precision = 10000d;
public FixedFlexImpl(Long index, double centreFrequency, double start, double stop, double wavelength) {
this.index = index;
}
public FixedFlexImpl(long wlIndex) {
- this.index = wlIndex;
- long mappedWL = wlIndex - 36;
- this.centerFrequency = 193.1 + (50.0 / 1000.0) * mappedWL;
- this.start = 193.1 + (50.0 * mappedWL - 25) / 1000.0;
- this.stop = 193.1 + (50.0 * mappedWL + 25) / 1000.0;
- this.wavelength = 1528.77 + ((wlIndex - 1) * 0.39);
+ this.centerFrequency = 196.1 - (wlIndex - 1) * wavelengthSpacing / 1000;
+ // Truncate the value to the two decimal places
+ this.centerFrequency = Math.round(this.centerFrequency * precision) / precision;
+ this.start = this.centerFrequency - (wavelengthSpacing / 2) / 1000;
+ this.start = Math.round(this.start * precision) / precision;
+ this.stop = this.centerFrequency + (wavelengthSpacing / 2) / 1000;
+ this.stop = Math.round(this.stop * precision) / precision;
+ this.wavelength = beginWavelength + ((wlIndex - 1) * 0.40);
+ this.wavelength = Math.round(this.wavelength * precision) / precision;
}
@Override
* @return Returns FixedFlexImp object with the calculated result.
**/
public FixedFlexImpl getFixedFlexWaveMapping(long wlIndex) {
+ // In Flex grid -35 <= n <= 60
+ long mappedWL = 61 - wlIndex;
FixedFlexImpl fixedFlex = new FixedFlexImpl();
- long mappedWL = wlIndex - 36;
fixedFlex.centerFrequency = 193.1 + (50.0 / 1000.0) * mappedWL;
+ fixedFlex.centerFrequency = Math.round(fixedFlex.centerFrequency * precision) / precision;
+ fixedFlex.wavelength = beginWavelength + ((wlIndex - 1) * 0.40);
+ fixedFlex.wavelength = Math.round(fixedFlex.wavelength * precision) / precision;
fixedFlex.start = 193.1 + (50.0 * mappedWL - 25) / 1000.0;
+ fixedFlex.start = Math.round(fixedFlex.start * precision) / precision;
fixedFlex.stop = 193.1 + (50.0 * mappedWL + 25) / 1000.0;
+ fixedFlex.stop = Math.round(fixedFlex.stop * precision) / precision;
+ fixedFlex.index = wlIndex;
return fixedFlex;
}
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'XPDR1-NETWORK1':
- self.assertEqual({u'frequency': 191.35, u'width': 40},
+ self.assertEqual({u'frequency': 196.1, u'width': 40},
ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength'])
if ele['tp-id'] == 'XPDR1-CLIENT1' or ele['tp-id'] == 'XPDR1-CLIENT3':
self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-client-attributes']))
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'SRG1-PP1-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40},
+ self.assertIn({u'index': 1, u'frequency': 196.1, u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
if ele['tp-id'] == 'SRG1-PP2-TXRX':
self.assertNotIn('used-wavelength', dict.keys(ele))
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'DEG1-CTP-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40},
+ self.assertIn({u'index': 1, u'frequency': 196.1, u'width': 40},
ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths'])
if ele['tp-id'] == 'DEG1-TTP-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40},
+ self.assertIn({u'index': 1, u'frequency': 196.1, u'width': 40},
ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths'])
time.sleep(3)
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'XPDR1-NETWORK1':
- self.assertEqual({u'frequency': 191.35, u'width': 40},
+ self.assertEqual({u'frequency': 196.1, u'width': 40},
ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength'])
if ele['tp-id'] == 'XPDR1-NETWORK2':
- self.assertEqual({u'frequency': 191.4, u'width': 40},
+ self.assertEqual({u'frequency': 196.05, u'width': 40},
ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength'])
if ele['tp-id'] == 'XPDR1-CLIENT1' or ele['tp-id'] == 'XPDR1-CLIENT3':
self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-client-attributes']))
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'SRG1-PP1-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40},
+ self.assertIn({u'index': 1, u'frequency': 196.1, u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
- self.assertNotIn({u'index': 2, u'frequency': 191.4, u'width': 40},
+ self.assertNotIn({u'index': 2, u'frequency': 196.05, u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
if ele['tp-id'] == 'SRG1-PP2-TXRX':
- self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40},
+ self.assertIn({u'index': 2, u'frequency': 196.05, u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
- self.assertNotIn({u'index': 1, u'frequency': 191.35, u'width': 40},
+ self.assertNotIn({u'index': 1, u'frequency': 196.1, u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
if ele['tp-id'] == 'SRG1-PP3-TXRX':
self.assertNotIn('org-openroadm-network-topology:pp-attributes', dict.keys(ele))
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'DEG1-CTP-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40},
+ self.assertIn({u'index': 1, u'frequency': 196.1, u'width': 40},
ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths'])
- self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40},
+ self.assertIn({u'index': 2, u'frequency': 196.05, u'width': 40},
ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths'])
if ele['tp-id'] == 'DEG1-TTP-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40},
+ self.assertIn({u'index': 1, u'frequency': 196.1, u'width': 40},
ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths'])
- self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40},
+ self.assertIn({u'index': 2, u'frequency': 196.05, u'width': 40},
ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths'])
time.sleep(10)
if __name__ == "__main__":
- unittest.main(verbosity=2)
\ No newline at end of file
+ unittest.main(verbosity=2)
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'XPDR1-NETWORK1':
- self.assertEqual({u'frequency': 191.35,
+ self.assertEqual({u'frequency': 196.1,
u'width': 40},
ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength'])
if ele['tp-id'] == 'XPDR1-CLIENT2' or ele['tp-id'] == 'XPDR1-CLIENT1':
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'SRG1-PP1-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35,
+ self.assertIn({u'index': 1, u'frequency': 196.1,
u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
if ele['tp-id'] == 'SRG1-PP2-TXRX':
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'DEG2-CTP-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35,
+ self.assertIn({u'index': 1, u'frequency': 196.1,
u'width': 40},
ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths'])
if ele['tp-id'] == 'DEG2-TTP-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35,
+ self.assertIn({u'index': 1, u'frequency': 196.1,
u'width': 40},
ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths'])
time.sleep(3)
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'XPDR1-NETWORK1':
- self.assertEqual({u'frequency': 191.35,
+ self.assertEqual({u'frequency': 196.1,
u'width': 40},
ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength'])
if ele['tp-id'] == 'XPDR1-NETWORK2':
- self.assertEqual({u'frequency': 191.4,
+ self.assertEqual({u'frequency': 196.05,
u'width': 40},
ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength'])
if ele['tp-id'] == 'XPDR1-CLIENT1' or ele['tp-id'] == 'XPDR1-CLIENT2':
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'SRG1-PP1-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35,
+ self.assertIn({u'index': 1, u'frequency': 196.1,
u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
- self.assertNotIn({u'index': 2, u'frequency': 191.4,
+ self.assertNotIn({u'index': 2, u'frequency': 196.05,
u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
if ele['tp-id'] == 'SRG1-PP2-TXRX':
- self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40},
+ self.assertIn({u'index': 2, u'frequency': 196.05, u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
- self.assertNotIn({u'index': 1, u'frequency': 191.35,
+ self.assertNotIn({u'index': 1, u'frequency': 196.1,
u'width': 40},
ele['org-openroadm-network-topology:pp-attributes']['used-wavelength'])
if ele['tp-id'] == 'SRG1-PP3-TXRX':
liste_tp = res['node'][0]['ietf-network-topology:termination-point']
for ele in liste_tp:
if ele['tp-id'] == 'DEG2-CTP-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35,
+ self.assertIn({u'index': 1, u'frequency': 196.1,
u'width': 40},
ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths'])
- self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40},
+ self.assertIn({u'index': 2, u'frequency': 196.05, u'width': 40},
ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths'])
if ele['tp-id'] == 'DEG2-TTP-TXRX':
- self.assertIn({u'index': 1, u'frequency': 191.35,
+ self.assertIn({u'index': 1, u'frequency': 196.1,
u'width': 40},
ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths'])
- self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40},
+ self.assertIn({u'index': 2, u'frequency': 196.05, u'width': 40},
ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths'])
time.sleep(10)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual(-5, res['org-openroadm-optical-channel-interfaces:och']['transmit-power'])
- self.assertEqual(191.35, res['org-openroadm-optical-channel-interfaces:och']['frequency'])
+ self.assertEqual(196.1, res['org-openroadm-optical-channel-interfaces:och']['frequency'])
def test_21_get_roadmconnection_ROADMA(self):
url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/ROADM-A1/yang-ext:mount/"
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual(-5 , res['org-openroadm-optical-channel-interfaces:och']['transmit-power'])
- self.assertEqual(191.35, res['org-openroadm-optical-channel-interfaces:och']['frequency'])
+ self.assertEqual(196.1, res['org-openroadm-optical-channel-interfaces:och']['frequency'])
def test_25_get_roadmconnection_ROADMC(self):
url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/ROADM-C1/yang-ext:mount/"
'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint',
'supporting-port': 'L1'}, res['interface'][0])
self.assertDictEqual(
- {u'frequency': 191.65, u'width': 40},
+ {u'frequency': 195.8, u'width': 40},
res['interface'][0]['org-openroadm-network-media-channel-interfaces:nmc-ctp'])
def test_07_service_path_create_rdm_check(self):
'type': 'org-openroadm-interfaces:mediaChannelTrailTerminationPoint',
'supporting-port': 'L1'}, res['interface'][0])
self.assertDictEqual(
- {u'min-freq': 191.625, u'max-freq': 191.67499999999998},
+ {u'min-freq': 195.775, u'max-freq': 195.825},
res['interface'][0]['org-openroadm-media-channel-interfaces:mc-ttp'])
'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint',
'supporting-port': 'C3'}, res['interface'][0])
self.assertDictEqual(
- {u'frequency': 191.65, u'width': 40},
+ {u'frequency': 195.8, u'width': 40},
res['interface'][0]['org-openroadm-network-media-channel-interfaces:nmc-ctp'])
# -mc supporting interfaces must not be created for SRG, only degrees
self.assertDictEqual(
{u'rate': u'org-openroadm-common-types:R100G',
u'transmit-power':-5,
- u'frequency': 191.65},
+ u'frequency': 195.8},
res['interface'][0]['org-openroadm-optical-channel-interfaces:och'])
def test_12_service_path_create_xpdr_check(self):