Open Kilda Java Documentation
PathComputationTest.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.atdd;
17 
18 import cucumber.api.PendingException;
19 import cucumber.api.java.en.Given;
20 import cucumber.api.java.en.Then;
21 import cucumber.api.java.en.When;
22 
24 
25 import java.io.File;
26 import java.nio.file.Files;
27 
28 import static org.junit.Assert.*;
29 
60 public class PathComputationTest {
61  private static final String fileName = "topologies/pce-spider-topology.json";
62 
63  //
64  // TODO: ensure bandwidth tests are part of this .. so we confirm policy & bandwidth
65  // TODO: Create the Expected Flows for each scenario / policy
66  // TODO: Can we confirm Neo4J, FlowCache, and FL/Switches?
67  //
68 
69  @Given("^a spider web topology with endpoints A and B$")
70  public void a_multi_path_topology() throws Throwable {
71  ClassLoader classLoader = getClass().getClassLoader();
72  File file = new File(classLoader.getResource(fileName).getFile());
73  String json = new String(Files.readAllBytes(file.toPath()));
74  assertTrue(TopologyHelp.CreateMininetTopology(json));
75  // Should also wait for some of this to come up
76 
77  }
78 
79  @Given("^no link properties$")
80  public void no_link_properties() throws Throwable {
81  // Write code here that turns the phrase above into concrete actions
82  throw new PendingException();
83  }
84 
85  @When("^link costs are uploaded through the NB API$")
86  public void link_costs_are_uploaded_through_the_NB_API() throws Throwable {
87  // Write code here that turns the phrase above into concrete actions
88  throw new PendingException();
89  }
90 
91  @Then("^link costs can be downloaded$")
92  public void link_costs_can_be_downloaded() throws Throwable {
93  // Write code here that turns the phrase above into concrete actions
94  throw new PendingException();
95  }
96 
97  @Then("^link properties reflect what is in the link properties table$")
99  // Write code here that turns the phrase above into concrete actions
100  throw new PendingException();
101  }
102 
103  @Then("^link costs can be deleted$")
104  public void link_costs_can_be_deleted() throws Throwable {
105  // Write code here that turns the phrase above into concrete actions
106  throw new PendingException();
107  }
108 
109  @When("^link costs are updated through the NB API$")
110  public void link_costs_are_updated_through_the_NB_API() throws Throwable {
111  // Write code here that turns the phrase above into concrete actions
112  throw new PendingException();
113  }
114 
115  @When("^a flow request is made between A and B with HOPS$")
116  public void a_flow_request_is_made_between_A_and_B_with_HOPS() throws Throwable {
117  // Write code here that turns the phrase above into concrete actions
118  throw new PendingException();
119  }
120 
121  @Then("^the path matches the HOPS$")
122  public void the_path_matches_the_HOPS() throws Throwable {
123  // Write code here that turns the phrase above into concrete actions
124  throw new PendingException();
125  }
126 
127  @Then("^the path between A and B is pingable$")
128  public void the_path_between_A_and_B_is_pingable() throws Throwable {
129  // Write code here that turns the phrase above into concrete actions
130  throw new PendingException();
131  }
132 
133  @When("^a flow request is made between A and B with LATENCY$")
135  // Write code here that turns the phrase above into concrete actions
136  throw new PendingException();
137  }
138 
139  @Then("^the path matches the LATENCY$")
140  public void the_path_matches_the_LATENCY() throws Throwable {
141  // Write code here that turns the phrase above into concrete actions
142  throw new PendingException();
143  }
144 
145  @When("^a flow request is made between A and B with COST$")
146  public void a_flow_request_is_made_between_A_and_B_with_COST() throws Throwable {
147  // Write code here that turns the phrase above into concrete actions
148  throw new PendingException();
149  }
150 
151  @Then("^the path matches the COST$")
152  public void the_path_matches_the_COST() throws Throwable {
153  // Write code here that turns the phrase above into concrete actions
154  throw new PendingException();
155  }
156 
157  @When("^a flow request is made between A and B with EXTERNAL(\\d+)$")
158  public void a_flow_request_is_made_between_A_and_B_with_EXTERNAL(int arg1) throws Throwable {
159  // Write code here that turns the phrase above into concrete actions
160  throw new PendingException();
161  }
162 
163  @Then("^the path matches the EXTERNAL(\\d+)$")
164  public void the_path_matches_the_EXTERNAL(int arg1) throws Throwable {
165  // Write code here that turns the phrase above into concrete actions
166  throw new PendingException();
167  }
168 
169  @When("^one or more links are added to the spider web topology$")
171  // Write code here that turns the phrase above into concrete actions
172  throw new PendingException();
173  }
174 
175  @Then("^the new links will have the cost properties added if the cost id matches$")
177  // Write code here that turns the phrase above into concrete actions
178  throw new PendingException();
179  }
180 
181 
182 }
static boolean CreateMininetTopology(String json)