blob: 8e9e92bb4fd73644ceff4ee8e52b68885e580a29 [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
Daniele Moro8d630f12021-06-15 20:53:22 +020019import org.onlab.util.ImmutableByteSequence;
Daniele Moro8d630f12021-06-15 20:53:22 +020020
21import java.util.Map;
Daniele Moro8d630f12021-06-15 20:53:22 +020022
23/**
24 * Stores state required for translation of UPF entities to pipeline-specific ones.
25 */
26public interface FabricUpfStore {
27 /**
28 * Clear all state associated with translation.
29 */
30 void reset();
31
32 /**
pierventre1eb98712021-07-13 18:03:22 +020033 * Returns the reverseFarIdMap.
Daniele Moro8d630f12021-06-15 20:53:22 +020034 *
35 * @return the farIdMap.
36 */
pierventre1eb98712021-07-13 18:03:22 +020037 Map<Integer, UpfRuleIdentifier> getReverseFarIdMap();
Daniele Moro8d630f12021-06-15 20:53:22 +020038
39 /**
40 * Get a globally unique integer identifier for the FAR identified by the given (Session ID, Far
41 * ID) pair.
42 *
43 * @param farIdPair a RuleIdentifier instance uniquely identifying the FAR
44 * @return A globally unique integer identifier
45 */
46 int globalFarIdOf(UpfRuleIdentifier farIdPair);
47
48 /**
pierventre1eb98712021-07-13 18:03:22 +020049 * Remove the global far id from the system.
50 *
51 * @param farIdPair a RuleIdentifier instance uniquely identifying the FAR
52 * @return A globally unique integer identifier
53 */
54 int removeGlobalFarId(UpfRuleIdentifier farIdPair);
55
56 /**
Daniele Moro8d630f12021-06-15 20:53:22 +020057 * Get a globally unique integer identifier for the FAR identified by the given (Session ID, Far
58 * ID) pair.
59 *
60 * @param pfcpSessionId The ID of the PFCP session that produced the FAR ID.
61 * @param sessionLocalFarId The FAR ID.
62 * @return A globally unique integer identifier
63 */
64 int globalFarIdOf(ImmutableByteSequence pfcpSessionId, int sessionLocalFarId);
65
66 /**
pierventre1eb98712021-07-13 18:03:22 +020067 * Remove the global far id from the system.
68 *
69 * @param pfcpSessionId The ID of the PFCP session that produced the FAR ID.
70 * @param sessionLocalFarId The FAR ID.
71 * @return A globally unique integer identifier
72 */
73 int removeGlobalFarId(ImmutableByteSequence pfcpSessionId, int sessionLocalFarId);
74
75 /**
Daniele Moro8d630f12021-06-15 20:53:22 +020076 * Get the corresponding PFCP session ID and session-local FAR ID from a globally unique FAR ID,
77 * or return null if no such mapping is found.
78 *
79 * @param globalFarId globally unique FAR ID
80 * @return the corresponding PFCP session ID and session-local FAR ID, as a RuleIdentifier
81 */
82 UpfRuleIdentifier localFarIdOf(int globalFarId);
Daniele Moro8d630f12021-06-15 20:53:22 +020083}