Determine preferred node/port from PCRI 68/109368/9
authorJoakim Törnqvist <joakim.tornqvist@smartoptics.com>
Thu, 7 Dec 2023 14:13:13 +0000 (14:13 +0000)
committerJoakim Törnqvist <joakim.tornqvist@smartoptics.com>
Fri, 16 Feb 2024 10:49:19 +0000 (10:49 +0000)
commit0ff30a6562e1d6fd8aa31a7b795ca5ecb398d7b0
tree1586078b16a4102f26fb5ac2d0c2c3ad2089b77a
parent56e494764739075a80f9b00f84145e0093081bb8
Determine preferred node/port from PCRI

Package intended to be used to determine preferred SRG port
usage when setting up optical services between ROADMs.

Use an instance of PathComputationRequestInput, e.g. API
input and provides a method for checking if a specific SRG port
is among the ports in the client request.

Package org.opendaylight.transportpce.pce.networkanalyzer.port:

* Preference        - Interface defining one method capable
                      of determining if a node/port is 'preferred'
                      by the client.
* ClientPreference  - Implements Preference. Contains information
                      about actual client port preference.
* NoPreference      - Implements Preference. Typically used when
                      the client has no preference regarding port.

* Factory           - Interface defining methods needed in order
                      to convert a PathComputationRequestInput
                      to an implementation of Preferenc.
* PreferenceFactory - Implements Factory. The method
                      'portPreference' should typically be used
                      implementing the feature in the application.

                      The method portPreference either returns
                      an instance of 'ClientPreference' or
                      'NoPreference'.

Example:

public void someMethod(PathComputationRequestInput input) {

    Factory portPreferenceFactory = new PreferenceFactory();

    Preference preference = portPreferenceFactory.portPreference(input);

    if (preference.preferredPort("ROADM-A-SRG1", "SRG1-PP1-TXRX")) {
        System.out.println("The port 'SRG1-PP1-TXRX' on 'ROADM-A-SRG1' "
                          +"is preferred by the client.");
    }

}

JIRA: TRNSPRTPCE-176
Change-Id: Iba7e7886678deb6d965391633f819995635caa06
Signed-off-by: Joakim Törnqvist <joakim.tornqvist@smartoptics.com>
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/port/ClientPreference.java [new file with mode: 0644]
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/port/Factory.java [new file with mode: 0644]
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/port/NoPreference.java [new file with mode: 0644]
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/port/Preference.java [new file with mode: 0644]
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/port/PreferenceFactory.java [new file with mode: 0644]
pce/src/test/java/org/opendaylight/transportpce/pce/networkanalyzer/port/ClientPreferenceTest.java [new file with mode: 0644]
pce/src/test/java/org/opendaylight/transportpce/pce/networkanalyzer/port/PreferenceFactoryTest.java [new file with mode: 0644]