X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Frepository%2FRic.java;h=fb2e4b92979b04fdf8c8ab482713f8a422922778;hb=6a39814272307d0207222c9229b0d765ac062bf0;hp=4291d6ef6e1ca8fb24f8e8260b2e15fa1cab28e1;hpb=9013ed7ad46ce6927fbf69890487e8df61b7d7ee;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/repository/Ric.java b/policy-agent/src/main/java/org/oransc/policyagent/repository/Ric.java index 4291d6ef..fb2e4b92 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/repository/Ric.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/repository/Ric.java @@ -20,10 +20,8 @@ package org.oransc.policyagent.repository; -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Vector; @@ -34,14 +32,13 @@ import org.oransc.policyagent.clients.A1Client.A1ProtocolType; import org.oransc.policyagent.configuration.RicConfig; /** - * Represents the dynamic information about a NearRealtime-RIC. + * Represents the dynamic information about a Near-RT RIC. */ public class Ric { - private final RicConfig ricConfig; - private final List managedElementIds; - - private RicState state = RicState.UNDEFINED; + @Setter + private RicConfig ricConfig; + private RicState state = RicState.UNAVAILABLE; private Map supportedPolicyTypes = new HashMap<>(); @Getter @Setter @@ -51,14 +48,12 @@ public class Ric { private final Lock lock = new Lock(); /** - * Creates the Ric. Initial state is {@link RicState.NOT_INITIATED}. + * Creates the Ric. Initial state is {@link RicState.UNDEFINED}. * * @param ricConfig The {@link RicConfig} for this Ric. */ public Ric(RicConfig ricConfig) { this.ricConfig = ricConfig; - this.managedElementIds = new ArrayList<>(ricConfig.managedElementIds()); // TODO, this is config why is it - // copied here? } public String name() { @@ -83,7 +78,7 @@ public class Ric { * @return a vector containing the nodes managed by this Ric. */ public synchronized Collection getManagedElementIds() { - return managedElementIds; + return ricConfig.managedElementIds(); } /** @@ -93,27 +88,7 @@ public class Ric { * @return true if the given node is managed by this Ric. */ public synchronized boolean isManaging(String managedElementId) { - return managedElementIds.contains(managedElementId); - } - - /** - * Adds the given node as managed by this Ric. - * - * @param managedElementId the node to add. - */ - public synchronized void addManagedElement(String managedElementId) { - if (!managedElementIds.contains(managedElementId)) { - managedElementIds.add(managedElementId); - } - } - - /** - * Removes the given node as managed by this Ric. - * - * @param managedElementId the node to remove. - */ - public synchronized void removeManagedElement(String managedElementId) { - managedElementIds.remove(managedElementId); + return ricConfig.managedElementIds().contains(managedElementId); } /** @@ -159,7 +134,7 @@ public class Ric { @Override public synchronized String toString() { return Ric.class.getSimpleName() + ": " + "name: " + name() + ", state: " + state + ", baseUrl: " - + ricConfig.baseUrl() + ", managedNodes: " + managedElementIds; + + ricConfig.baseUrl() + ", managedNodes: " + ricConfig.managedElementIds(); } /** @@ -169,14 +144,19 @@ public class Ric { /** * The agent view of the Ric may be inconsistent. */ - UNDEFINED, + UNAVAILABLE, /** * The normal state. Policies can be configured. */ - IDLE, + AVAILABLE, /** * The agent is synchronizing the view of the Ric. */ - SYNCHRONIZING + SYNCHRONIZING, + + /** + * A consistency check between the agent and the Ric is done + */ + CONSISTENCY_CHECK } }