blob: 786ef3c73f3097b9904955801e10e33b516cfb7f [file] [log] [blame]
Daniele Moro8d630f12021-06-15 20:53:22 +02001/*
2 * Copyright 2021-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.pipelines.fabric.impl.behaviour.upf;
18
19import org.onlab.packet.Ip4Address;
20import org.onlab.util.ImmutableByteSequence;
21import org.onosproject.net.behaviour.upf.PacketDetectionRule;
22
23import java.util.Map;
24import java.util.Set;
25
26/**
27 * Stores state required for translation of UPF entities to pipeline-specific ones.
28 */
29public interface FabricUpfStore {
30 /**
31 * Clear all state associated with translation.
32 */
33 void reset();
34
35 /**
36 * Returns the farIdMap.
37 *
38 * @return the farIdMap.
39 */
40 Map<UpfRuleIdentifier, Integer> getFarIdMap();
41
42 /**
43 * Get a globally unique integer identifier for the FAR identified by the given (Session ID, Far
44 * ID) pair.
45 *
46 * @param farIdPair a RuleIdentifier instance uniquely identifying the FAR
47 * @return A globally unique integer identifier
48 */
49 int globalFarIdOf(UpfRuleIdentifier farIdPair);
50
51 /**
52 * Get a globally unique integer identifier for the FAR identified by the given (Session ID, Far
53 * ID) pair.
54 *
55 * @param pfcpSessionId The ID of the PFCP session that produced the FAR ID.
56 * @param sessionLocalFarId The FAR ID.
57 * @return A globally unique integer identifier
58 */
59 int globalFarIdOf(ImmutableByteSequence pfcpSessionId, int sessionLocalFarId);
60
61 /**
62 * Get the corresponding PFCP session ID and session-local FAR ID from a globally unique FAR ID,
63 * or return null if no such mapping is found.
64 *
65 * @param globalFarId globally unique FAR ID
66 * @return the corresponding PFCP session ID and session-local FAR ID, as a RuleIdentifier
67 */
68 UpfRuleIdentifier localFarIdOf(int globalFarId);
69
70 /**
71 * Get the corresponding queue Id from scheduling priority.
72 *
73 * @param schedulingPriority QCI scheduling priority
74 * @return the corresponding queue ID
75 */
76 String queueIdOf(int schedulingPriority);
77
78 /**
79 * Get the corresponding queue Id from scheduling priority.
80 *
81 * @param queueId Tofino queue Id
82 * @return the corresponding scheduling priroity
83 */
84 String schedulingPriorityOf(int queueId);
85
86 /**
87 * Stores the mapping between FAR ID and UE address as defined by the given PDR.
88 *
89 * @param pdr PDR
90 */
91 void learnFarIdToUeAddrs(PacketDetectionRule pdr);
92
93 /**
94 * Returns true if the given FAR IDs is known to be a buffering one.
95 *
96 * @param farId FAR ID
97 * @return boolean
98 */
99 boolean isFarIdBuffering(UpfRuleIdentifier farId);
100
101 /**
102 * Learns the given FAR ID as being a buffering one.
103 *
104 * @param farId FAR ID
105 */
106 void learBufferingFarId(UpfRuleIdentifier farId);
107
108 /**
109 * Forgets the given FAR ID as being a buffering one.
110 *
111 * @param farId FAR ID
112 */
113 void forgetBufferingFarId(UpfRuleIdentifier farId);
114
115 /**
116 * Returns the set of UE addresses associated with the given FAR ID.
117 *
118 * @param farId FAR ID
119 * @return Set of Ip4Address
120 */
121 Set<Ip4Address> ueAddrsOfFarId(UpfRuleIdentifier farId);
122
123 /**
124 * Removes the given UE address from the FAR ID to UE address map.
125 * @param ueAddr UE address
126 */
127 void forgetUeAddr(Ip4Address ueAddr);
128
129 /**
130 * Returns the set of known buffering FAR IDs.
131 * @return set
132 */
133 Set<UpfRuleIdentifier> getBufferFarIds();
134
135 /**
136 * Returns the FAR ID to UE addresses map.
137 *
138 * @return map
139 */
140 Map<UpfRuleIdentifier, Set<Ip4Address>> getFarIdToUeAddrs();
141}