Open Kilda Java Documentation
NorthboundService.java
Go to the documentation of this file.
1 /* Copyright 2018 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.testing.service.northbound;
17 
35 
36 import java.util.List;
37 import java.util.stream.Collectors;
38 
39 public interface NorthboundService {
40 
42 
43  //flows
44 
45  FlowPayload getFlow(String flowId);
46 
48 
49  FlowPayload updateFlow(String flowId, FlowPayload payload);
50 
51  FlowPayload deleteFlow(String flowId);
52 
53  List<FlowPayload> deleteAllFlows();
54 
55  FlowPathPayload getFlowPath(String flowId);
56 
57  FlowIdStatusPayload getFlowStatus(String flowId);
58 
59  List<FlowPayload> getAllFlows();
60 
61  List<FlowValidationDto> validateFlow(String flowId);
62 
63  FlowReroutePayload rerouteFlow(String flowId);
64 
65  //switches
66 
68 
69  List<Long> deleteSwitchRules(SwitchId switchId);
70 
72 
74 
75  List<SwitchInfoData> getAllSwitches();
76 
77  DeleteMeterResult deleteMeter(SwitchId switchId, Integer meterId);
78 
79  //links
80 
81  List<IslInfoData> getAllLinks();
82 
83  List<LinkPropsDto> getAllLinkProps();
84 
85  List<LinkPropsDto> getLinkProps(SwitchId srcSwitch, Integer srcPort, SwitchId dstSwitch, Integer dstPort);
86 
87  BatchResults updateLinkProps(List<LinkPropsDto> keys);
88 
89  BatchResults deleteLinkProps(List<LinkPropsDto> keys);
90 
91  //feature toggles
92 
94 
96 
100  default List<IslInfoData> getActiveLinks() {
101  return getAllLinks().stream()
102  .filter(sw -> sw.getState() == IslChangeType.DISCOVERED)
103  .collect(Collectors.toList());
104  }
105 
109  default List<SwitchInfoData> getActiveSwitches() {
110  return getAllSwitches().stream()
111  .filter(sw -> sw.getState().isActive())
112  .collect(Collectors.toList());
113  }
114 
115 }
List< FlowValidationDto > validateFlow(String flowId)
List< LinkPropsDto > getLinkProps(SwitchId srcSwitch, Integer srcPort, SwitchId dstSwitch, Integer dstPort)
RulesValidationResult validateSwitchRules(SwitchId switchId)
BatchResults updateLinkProps(List< LinkPropsDto > keys)
FeatureTogglePayload toggleFeature(FeatureTogglePayload request)
DeleteMeterResult deleteMeter(SwitchId switchId, Integer meterId)
RulesSyncResult synchronizeSwitchRules(SwitchId switchId)
BatchResults deleteLinkProps(List< LinkPropsDto > keys)
FlowPayload updateFlow(String flowId, FlowPayload payload)
SwitchFlowEntries getSwitchRules(SwitchId switchId)
FlowIdStatusPayload getFlowStatus(String flowId)