1 package org.openkilda.simulator.classes;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertFalse;
5 import static org.junit.Assert.assertTrue;
10 import org.junit.After;
11 import org.junit.Before;
12 import org.junit.Rule;
13 import org.junit.Test;
14 import org.junit.rules.ExpectedException;
15 import org.projectfloodlight.openflow.types.DatapathId;
17 import java.util.List;
22 private int numOfPorts = 10;
26 public ExpectedException
thrown = ExpectedException.none();
30 public void setUp() throws Exception {
45 assertEquals(dpid.
toString(), sw2.getDpidAsString());
46 assertEquals(DatapathId.of(dpid.
toLong()), sw2.getDpid());
47 assertEquals(0, sw2.getMaxPorts());
50 List<IPortImpl> ports = sw3.getPorts();
51 assertEquals(numOfPorts, ports.size());
53 assertFalse(
port.isActive());
85 assertEquals(dpid, sw.
getDpid());
94 thrown.expectMessage(
"Switch already has reached maxPorts");
101 int numOfPorts = sw.
getPorts().size();
105 thrown.expectMessage(String.format(
"Port %d is not defined on %s", numOfPorts, sw.
getDpidAsString()));
void setDpid(DatapathId dpid)
List< IPortImpl > getPorts()
IPortImpl getPort(int portNum)
void modState(SwitchState state)
void testActivateDeactivate()
int addPort(IPortImpl port)