blob: a61a8115878b1d1fdfa012fa1067fa55e51fe853 [file] [log] [blame]
Mohammad Shahid4c30ea32017-08-09 18:02:10 +05301/*
2 * Copyright 2017-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.evpnopenflow.rsc.vpninstance;
18
19import com.fasterxml.jackson.databind.JsonNode;
20import org.onosproject.evpnopenflow.rsc.VpnInstance;
21import org.onosproject.evpnopenflow.rsc.VpnInstanceId;
Ray Milkeya95193c2017-08-10 15:35:36 -070022import org.onosproject.evpnrouteservice.VpnRouteTarget;
Mohammad Shahid4c30ea32017-08-09 18:02:10 +053023
24import java.util.Collection;
25import java.util.Set;
26
27/**
28 * Service for interacting with the inventory of VPN instance.
29 */
30public interface VpnInstanceService {
31 /**
32 * Returns if the vpnInstance is existed.
33 *
34 * @param vpnInstanceId vpnInstance identifier
35 * @return true or false if one with the given identifier is not existed.
36 */
37 boolean exists(VpnInstanceId vpnInstanceId);
38
39 /**
40 * Returns the vpnInstance with the identifier.
41 *
42 * @param vpnInstanceId vpnInstance ID
43 * @return VpnInstance or null if one with the given ID is not know.
44 */
45 VpnInstance getInstance(VpnInstanceId vpnInstanceId);
46
47 /**
48 * Returns the collection of the currently known vpnInstance.
49 *
50 * @return collection of VpnInstance.
51 */
52 Collection<VpnInstance> getInstances();
53
54 /**
55 * Creates vpnInstances by vpnInstances.
56 *
57 * @param vpnInstances the iterable collection of vpnInstances
58 * @return true if all given identifiers created successfully.
59 */
60 boolean createInstances(Iterable<VpnInstance> vpnInstances);
61
62 /**
63 * Updates vpnInstances by vpnInstances.
64 *
65 * @param vpnInstances the iterable collection of vpnInstances
66 * @return true if all given identifiers updated successfully.
67 */
68 boolean updateInstances(Iterable<VpnInstance> vpnInstances);
69
70 /**
71 * Deletes vpnInstanceIds by vpnInstanceIds.
72 *
73 * @param vpnInstanceIds the iterable collection of vpnInstance identifiers
74 * @return true or false if one with the given identifier to delete is
75 * successfully.
76 */
77 boolean removeInstances(Iterable<VpnInstanceId> vpnInstanceIds);
78
79 /**
80 * process gluon config for vpn instance information.
81 *
82 * @param action can be either update or delete
83 * @param key can contain the id and also target information
84 * @param value content of the vpn instance configuration
85 */
86 void processGluonConfig(String action, String key, JsonNode value);
87
88 /**
89 * process Etcd response for vpn instance information.
90 *
91 * @param routeTargetType route target type
92 * @param exportRouteTargets export route targets
93 * @param importRouteTargets import route targets
94 * @param vpnRouteTarget vpn route target
95 */
96 void updateImpExpRouteTargets(String routeTargetType,
97 Set<VpnRouteTarget> exportRouteTargets,
98 Set<VpnRouteTarget> importRouteTargets,
99 VpnRouteTarget vpnRouteTarget);
100}