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=220477f04187aaac8054f6b675aa256f227ca5e3;hb=9fb9f6e4fe8eb9425d848ae576c0e755dfca22df;hp=98c497f76909f5f340e8d90ab9785925d25483a1;hpb=e6f2305abd791d003d4729c3bd8c8652d89eed70;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 98c497f7..220477f0 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 @@ -25,6 +25,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Vector; +import lombok.Getter; +import lombok.Setter; + +import org.oransc.policyagent.clients.A1Client.A1ProtocolType; import org.oransc.policyagent.configuration.RicConfig; /** @@ -32,8 +36,13 @@ import org.oransc.policyagent.configuration.RicConfig; */ public class Ric { private final RicConfig ricConfig; - private RicState state = RicState.NOT_INITIATED; + @Getter + @Setter + private RicState state = RicState.UNDEFINED; private Map supportedPolicyTypes = new HashMap<>(); + @Getter + @Setter + private A1ProtocolType protocolVersion = A1ProtocolType.UNKNOWN; /** * Creates the Ric. Initial state is {@link RicState.NOT_INITIATED}. @@ -48,14 +57,6 @@ public class Ric { return ricConfig.name(); } - public RicState state() { - return state; - } - - public void setState(RicState newState) { - state = newState; - } - public RicConfig getConfig() { return this.ricConfig; } @@ -65,38 +66,38 @@ public class Ric { * * @return a vector containing the nodes managed by this Ric. */ - public Vector getManagedNodes() { + public Vector getManagedElementIds() { return ricConfig.managedElementIds(); } /** * Determines if the given node is managed by this Ric. * - * @param nodeName the node name to check. + * @param managedElementId the node name to check. * @return true if the given node is managed by this Ric. */ - public boolean isManaging(String nodeName) { - return ricConfig.managedElementIds().contains(nodeName); + public boolean isManaging(String managedElementId) { + return ricConfig.managedElementIds().contains(managedElementId); } /** * Adds the given node as managed by this Ric. * - * @param nodeName the node to add. + * @param managedElementId the node to add. */ - public void addManagedNode(String nodeName) { - if (!ricConfig.managedElementIds().contains(nodeName)) { - ricConfig.managedElementIds().add(nodeName); + public void addManagedElement(String managedElementId) { + if (!ricConfig.managedElementIds().contains(managedElementId)) { + ricConfig.managedElementIds().add(managedElementId); } } /** * Removes the given node as managed by this Ric. * - * @param nodeName the node to remove. + * @param managedElementId the node to remove. */ - public void removeManagedNode(String nodeName) { - ricConfig.managedElementIds().remove(nodeName); + public void removeManagedElement(String managedElementId) { + ricConfig.managedElementIds().remove(managedElementId); } /** @@ -122,23 +123,10 @@ public class Ric { } /** - * Adds policy types as supported by this Ric. - * - * @param types the policy types to support. - */ - public void addSupportedPolicyTypes(Collection types) { - for (PolicyType type : types) { - addSupportedPolicyType(type); - } - } - - /** - * Removes a policy type as supported by this Ric. - * - * @param type the policy type to remove as supported by this Ric. + * Removes all policy type as supported by this Ric. */ - public void removeSupportedPolicyType(PolicyType type) { - supportedPolicyTypes.remove(type.name()); + public void clearSupportedPolicyTypes() { + supportedPolicyTypes.clear(); } /** @@ -163,16 +151,16 @@ public class Ric { */ public static enum RicState { /** - * The Ric has not been initiated yet. + * The agent view of the agent may be inconsistent. */ - NOT_INITIATED, + UNDEFINED, /** - * The Ric is working fine. + * The normal state. Policies can be configured. */ - ACTIVE, + IDLE, /** - * The Ric cannot be contacted. + * The Ric states are recovered. */ - NOT_REACHABLE + RECOVERING } }