Dhruv Dhody
Committed by Thomas Vachuska

ONOS-2740,ONOS-2741,from ONOS-3032 - to ONOS 3071 , OSPF Protocol Implementation Unit Tests

Change-Id: Ie7f02bd9bff16902647c7af406f7ece9cdf0ae6c
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.area;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onosproject.ospf.controller.OspfNbr;
import org.onosproject.ospf.controller.TopologyForDeviceAndLink;
import org.onosproject.ospf.controller.impl.Controller;
import org.onosproject.ospf.controller.impl.OspfInterfaceChannelHandler;
import org.onosproject.ospf.controller.impl.OspfNbrImpl;
import org.onosproject.ospf.controller.impl.TopologyForDeviceAndLinkImpl;
import org.onosproject.ospf.protocol.lsa.OpaqueLsaHeader;
import org.onosproject.ospf.protocol.util.OspfInterfaceState;
import java.util.HashMap;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
/**
* Unit test class for OspfInterfaceImpl.
*/
public class OspfInterfaceImplTest {
private OspfInterfaceImpl ospfInterface;
private OspfNbrImpl ospfNbr;
private OpaqueLsaHeader opaqueLsaHeader;
private int result;
private HashMap<String, OspfNbr> ospfNbrHashMap;
private TopologyForDeviceAndLink topologyForDeviceAndLink;
@Before
public void setUp() throws Exception {
ospfInterface = new OspfInterfaceImpl();
topologyForDeviceAndLink = new TopologyForDeviceAndLinkImpl();
}
@After
public void tearDown() throws Exception {
ospfInterface = null;
ospfNbr = null;
opaqueLsaHeader = null;
ospfNbrHashMap = null;
}
/**
* Tests state() getter method.
*/
@Test
public void testGetState() throws Exception {
ospfInterface.setState(OspfInterfaceState.DROTHER);
assertThat(ospfInterface.state(), is(OspfInterfaceState.DROTHER));
}
/**
* Tests state() setter method.
*/
@Test
public void testSetState() throws Exception {
ospfInterface.setState(OspfInterfaceState.DROTHER);
assertThat(ospfInterface.state(), is(OspfInterfaceState.DROTHER));
}
/**
* Tests linkStateHeaders() method.
*/
@Test
public void testGetLinkStateHeaders() throws Exception {
assertThat(ospfInterface.linkStateHeaders().size(), is(0));
}
/**
* Tests ipNetworkMask() getter method.
*/
@Test
public void testGetIpNetworkMask() throws Exception {
ospfInterface.setIpNetworkMask(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfInterface.ipNetworkMask(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests ipNetworkMask() setter method.
*/
@Test
public void testSetIpNetworkMask() throws Exception {
ospfInterface.setIpNetworkMask(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfInterface.ipNetworkMask(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests addNeighbouringRouter() method.
*/
@Test
public void testAddNeighbouringRouter() throws Exception {
ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(),
new OspfInterfaceImpl())
, topologyForDeviceAndLink);
ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
ospfInterface.addNeighbouringRouter(ospfNbr);
assertThat(ospfInterface, is(notNullValue()));
}
/**
* Tests neighbouringRouter() method.
*/
@Test
public void testGetNeighbouringRouter() throws Exception {
ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(),
new OspfInterfaceImpl())
, topologyForDeviceAndLink);
ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
ospfInterface.addNeighbouringRouter(ospfNbr);
assertThat(ospfInterface.neighbouringRouter("111.111.111.111"), is(notNullValue()));
}
/**
* Tests addLsaHeaderForDelayAck() method.
*/
@Test
public void testAddLsaHeaderForDelayAck() throws Exception {
opaqueLsaHeader = new OpaqueLsaHeader();
opaqueLsaHeader.setLsType(10);
ospfInterface.addLsaHeaderForDelayAck(opaqueLsaHeader);
assertThat(ospfInterface, is(notNullValue()));
}
/**
* Tests removeLsaFromNeighborMap() method.
*/
@Test
public void testRemoveLsaFromNeighborMap() throws Exception {
ospfInterface.removeLsaFromNeighborMap("lsa10");
assertThat(ospfInterface, is(notNullValue()));
}
/**
* Tests isNeighborInList() method.
*/
@Test
public void testIsNeighborinList() throws Exception {
ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(),
new OspfInterfaceImpl())
, topologyForDeviceAndLink);
ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
ospfInterface.addNeighbouringRouter(ospfNbr);
assertThat(ospfInterface.isNeighborInList("111.111.111.111"), is(notNullValue()));
}
/**
* Tests listOfNeighbors() getter method.
*/
@Test
public void testGetListOfNeighbors() throws Exception {
ospfNbrHashMap = new HashMap();
ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
new OspfInterfaceChannelHandler(new Controller(),
new OspfAreaImpl(),
new OspfInterfaceImpl())
, topologyForDeviceAndLink);
ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
ospfNbrHashMap.put("111.111.111.111", ospfNbr);
ospfInterface.setListOfNeighbors(ospfNbrHashMap);
assertThat(ospfInterface.listOfNeighbors().size(), is(1));
}
/**
* Tests listOfNeighbors() setter method.
*/
@Test
public void testSetListOfNeighbors() throws Exception {
ospfNbrHashMap = new HashMap();
ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(),
new OspfInterfaceImpl())
, topologyForDeviceAndLink);
ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
ospfNbrHashMap.put("111.111.111.111", ospfNbr);
ospfInterface.setListOfNeighbors(ospfNbrHashMap);
assertThat(ospfInterface.listOfNeighbors().size(), is(1));
}
/**
* Tests ipAddress() getter method.
*/
@Test
public void testGetIpAddress() throws Exception {
ospfInterface.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfInterface.ipAddress(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests ipAddress() getter method.
*/
@Test
public void testSetIpAddress() throws Exception {
ospfInterface.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfInterface.ipAddress(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests routerPriority() getter method.
*/
@Test
public void testGetRouterPriority() throws Exception {
ospfInterface.setRouterPriority(1);
Assert.assertEquals(1, ospfInterface.routerPriority());
}
/**
* Tests routerPriority() setter method.
*/
@Test
public void testSetRouterPriority() throws Exception {
ospfInterface.setRouterPriority(1);
assertThat(ospfInterface.routerPriority(), is(1));
}
/**
* Tests areaId() getter method.
*/
@Test
public void testGetAreaId() throws Exception {
ospfInterface.setAreaId(1);
assertThat(ospfInterface.areaId(), is(1));
}
/**
* Tests areaId() setter method.
*/
@Test
public void testSetAreaId() throws Exception {
ospfInterface.setAreaId(1);
assertThat(ospfInterface.areaId(), is(1));
}
/**
* Tests helloIntervalTime() getter method.
*/
@Test
public void testGetHelloIntervalTime() throws Exception {
ospfInterface.setHelloIntervalTime(10);
assertThat(ospfInterface.helloIntervalTime(), is(10));
}
/**
* Tests helloIntervalTime() setter method.
*/
@Test
public void testSetHelloIntervalTime() throws Exception {
ospfInterface.setHelloIntervalTime(10);
assertThat(ospfInterface.helloIntervalTime(), is(10));
}
/**
* Tests routerDeadIntervalTime() getter method.
*/
@Test
public void testGetRouterDeadIntervalTime() throws Exception {
ospfInterface.setRouterDeadIntervalTime(10);
assertThat(ospfInterface.routerDeadIntervalTime(), is(10));
}
/**
* Tests routerDeadIntervalTime() setter method.
*/
@Test
public void testSetRouterDeadIntervalTime() throws Exception {
ospfInterface.setRouterDeadIntervalTime(10);
assertThat(ospfInterface.routerDeadIntervalTime(), is(10));
}
/**
* Tests interfaceType() getter method.
*/
@Test
public void testGetInterfaceType() throws Exception {
ospfInterface.setInterfaceType(1);
assertThat(ospfInterface.interfaceType(), is(1));
}
/**
* Tests interfaceType() setter method.
*/
@Test
public void testSetInterfaceType() throws Exception {
ospfInterface.setInterfaceType(1);
assertThat(ospfInterface.interfaceType(), is(1));
}
/**
* Tests interfaceCost() getter method.
*/
@Test
public void testGetInterfaceCost() throws Exception {
ospfInterface.setInterfaceCost(100);
assertThat(ospfInterface.interfaceCost(), is(100));
}
/**
* Tests interfaceCost() setter method.
*/
@Test
public void testSetInterfaceCost() throws Exception {
ospfInterface.setInterfaceCost(100);
assertThat(ospfInterface.interfaceCost(), is(100));
}
/**
* Tests authType() getter method.
*/
@Test
public void testGetAuthType() throws Exception {
ospfInterface.setAuthType("00");
assertThat(ospfInterface.authType(), is("00"));
}
/**
* Tests authType() setter method.
*/
@Test
public void testSetAuthType() throws Exception {
ospfInterface.setAuthType("00");
assertThat(ospfInterface.authType(), is("00"));
}
/**
* Tests authKey() getter method.
*/
@Test
public void testGetAuthKey() throws Exception {
ospfInterface.setAuthKey("00");
assertThat(ospfInterface.authKey(), is("00"));
}
/**
* Tests authKey() setter method.
*/
@Test
public void testSetAuthKey() throws Exception {
ospfInterface.setAuthKey("00");
assertThat(ospfInterface.authKey(), is("00"));
}
/**
* Tests pollInterval() getter method.
*/
@Test
public void testGetPollInterval() throws Exception {
ospfInterface.setPollInterval(100);
assertThat(ospfInterface.pollInterval(), is(100));
}
/**
* Tests pollInterval() setter method.
*/
@Test
public void testSetPollInterval() throws Exception {
ospfInterface.setPollInterval(100);
assertThat(ospfInterface.pollInterval(), is(100));
}
/**
* Tests mtu() getter method.
*/
@Test
public void testGetMtu() throws Exception {
ospfInterface.setMtu(100);
assertThat(ospfInterface.mtu(), is(100));
}
/**
* Tests mtu() setter method.
*/
@Test
public void testSetMtu() throws Exception {
ospfInterface.setMtu(100);
assertThat(ospfInterface.mtu(), is(100));
}
/**
* Tests reTransmitInterval() getter method.
*/
@Test
public void testGetReTransmitInterval() throws Exception {
ospfInterface.setReTransmitInterval(100);
assertThat(ospfInterface.reTransmitInterval(), is(100));
}
/**
* Tests reTransmitInterval() setter method.
*/
@Test
public void testSetReTransmitInterval() throws Exception {
ospfInterface.setReTransmitInterval(100);
assertThat(ospfInterface.reTransmitInterval(), is(100));
}
/**
* Tests dr() getter method.
*/
@Test
public void testGetDr() throws Exception {
ospfInterface.setDr(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfInterface.dr(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests dr() setter method.
*/
@Test
public void testSetDr() throws Exception {
ospfInterface.setDr(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfInterface.dr(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests bdr() getter method.
*/
@Test
public void testGetBdr() throws Exception {
ospfInterface.setBdr(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfInterface.bdr(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests bdr() setter method.
*/
@Test
public void testSetBdr() throws Exception {
ospfInterface.setBdr(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfInterface.bdr(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests transmitDelay() getter method.
*/
@Test
public void testGetTransmitDelay() throws Exception {
ospfInterface.setTransmitDelay(100);
assertThat(ospfInterface.transmitDelay(), is(100));
}
/**
* Tests transmitDelay() setter method.
*/
@Test
public void testSetTransmitDelay() throws Exception {
ospfInterface.setTransmitDelay(100);
assertThat(ospfInterface.transmitDelay(), is(100));
}
/**
* Tests equals() method.
*/
@Test
public void testEquals() throws Exception {
assertThat(ospfInterface.equals(new OspfInterfaceImpl()), is(true));
}
/**
* Tests hashCode() method.
*/
@Test
public void testHashCode() throws Exception {
result = ospfInterface.hashCode();
assertThat(result, is(notNullValue()));
}
/**
* Tests to string method.
*/
@Test
public void testToString() throws Exception {
assertThat(ospfInterface.toString(), is(notNullValue()));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.area;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onosproject.ospf.controller.OspfArea;
import java.util.ArrayList;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
/**
* Unit test class for OspfProcessImpl.
*/
public class OspfProcessImplTest {
private OspfProcessImpl ospfProcess;
private List<OspfArea> list;
private List result;
@Before
public void setUp() throws Exception {
ospfProcess = new OspfProcessImpl();
}
@After
public void tearDown() throws Exception {
ospfProcess = null;
list = null;
}
/**
* Tests areas() getter method.
*/
@Test
public void testGetAreas() throws Exception {
list = new ArrayList();
list.add(new OspfAreaImpl());
list.add(new OspfAreaImpl());
ospfProcess.setAreas(list);
result = ospfProcess.areas();
assertThat(result.size(), is(2));
}
/**
* Tests areas() setter method.
*/
@Test
public void testSetAreas() throws Exception {
list = new ArrayList();
list.add(new OspfAreaImpl());
list.add(new OspfAreaImpl());
ospfProcess.setAreas(list);
result = ospfProcess.areas();
assertThat(result.size(), is(2));
}
/**
* Tests processId() getter method.
*/
@Test
public void testGetProcessId() throws Exception {
ospfProcess.setProcessId("1.1.1.1");
assertThat(ospfProcess.processId(), is("1.1.1.1"));
}
/**
* Tests processId() setter method.
*/
@Test
public void testSetProcessId() throws Exception {
ospfProcess.setProcessId("1.1.1.1");
assertThat(ospfProcess.processId(), is("1.1.1.1"));
}
/**
* Tests to string method.
*/
@Test
public void testToString() throws Exception {
assertThat(ospfProcess.toString(), is(notNullValue()));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onosproject.net.driver.DriverService;
import org.onosproject.ospf.controller.OspfAgent;
import org.onosproject.ospf.controller.OspfArea;
import org.onosproject.ospf.controller.OspfInterface;
import org.onosproject.ospf.controller.OspfProcess;
import org.onosproject.ospf.controller.OspfRouter;
import org.onosproject.ospf.controller.area.OspfAreaImpl;
import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
import org.onosproject.ospf.controller.area.OspfProcessImpl;
import java.nio.channels.Channel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for Controller.
*/
public class ControllerTest {
private Controller controller;
private Map<String, Long> maps;
private OspfAgent ospfAgent;
private DriverService driverService;
private List<Channel> connectedChannels;
private List<OspfProcess> process;
private OspfProcess ospfProcess;
private OspfArea ospfArea;
private OspfInterface ospfInterface;
private List<OspfInterface> ospfInterfaces;
private List<OspfArea> ospfAreas;
private List<OspfProcess> ospfProcesses;
private OspfProcess ospfProcess1;
private OspfArea ospfArea1;
private OspfRouter ospfRouter;
@Before
public void setUp() throws Exception {
controller = new Controller();
maps = new HashMap<String, Long>();
ospfProcess = new OspfProcessImpl();
ospfArea = new OspfAreaImpl();
ospfInterface = new OspfInterfaceImpl();
ospfInterfaces = new ArrayList();
ospfInterface.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
ospfInterfaces.add(ospfInterface);
ospfArea.setAreaId(Ip4Address.valueOf("2.2.2.2"));
ospfArea.setInterfacesLst(ospfInterfaces);
ospfProcess.setProcessId("10.10.10.10");
ospfAreas = new ArrayList();
ospfAreas.add(ospfArea);
ospfProcess.setAreas(ospfAreas);
ospfProcesses = new ArrayList();
ospfProcesses.add(ospfProcess);
ospfProcess1 = new OspfProcessImpl();
ospfProcess1.setProcessId("11.11.11.11");
ospfArea1 = new OspfAreaImpl();
ospfArea1.setAreaId(Ip4Address.valueOf("2.2.2.2"));
ospfArea1.setInterfacesLst(ospfInterfaces);
ospfAreas.add(ospfArea1);
ospfProcess1.setAreas(ospfAreas);
ospfProcesses.add(ospfProcess1);
connectedChannels = new ArrayList<>();
}
@After
public void tearDown() throws Exception {
controller = null;
maps.clear();
connectedChannels.clear();
controller = null;
maps = null;
ospfAgent = null;
driverService = null;
connectedChannels = null;
process = null;
ospfProcess = null;
ospfArea = null;
ospfInterface = null;
ospfInterfaces = null;
ospfAreas = null;
ospfProcesses = null;
ospfProcess1 = null;
ospfArea1 = null;
}
/**
* Tests getAllConfiguredProcesses() method.
*/
@Test
public void testGetAllConfiguredProcesses() throws Exception {
process = controller.getAllConfiguredProcesses();
assertThat(process, is(nullValue()));
}
/**
* Tests addDeviceDetails() method.
*/
@Test(expected = Exception.class)
public void testAddDeviceDetails() throws Exception {
controller.addDeviceDetails(new OspfRouterImpl());
assertThat(controller, is(notNullValue()));
}
/**
* Tests removeDeviceDetails() method.
*/
@Test(expected = Exception.class)
public void testRemoveDeviceDetails() throws Exception {
controller.removeDeviceDetails(new OspfRouterImpl());
assertThat(controller, is(notNullValue()));
}
/**
* Tests init() method.
*/
@Test
public void testInit() throws Exception {
controller.init();
assertThat(controller.systemStartTime, is(notNullValue()));
}
/**
* Tests start() method.
*/
@Test
public void testStart() throws Exception {
ospfAgent = EasyMock.createMock(OspfAgent.class);
controller.start(ospfAgent, driverService);
controller.updateConfig(ospfProcesses);
assertThat(controller, is(notNullValue()));
}
/**
* Tests stop() method.
*/
@Test(expected = Exception.class)
public void testStop() throws Exception {
controller.start(ospfAgent, driverService);
controller.stop();
assertThat(controller, is(notNullValue()));
}
/**
* Tests deleteInterfaceFromArea() method.
*/
@Test
public void testDeleteInterfaceFromArea() throws Exception {
controller.updateConfig(ospfProcesses);
assertThat(controller.deleteInterfaceFromArea("10.10.10.10", "2.2.2.2", "1.1.1.1"), is(true));
assertThat(controller.deleteInterfaceFromArea("10.10.10.10", "2.2.2.2", "5.5.5.5"), is(false));
}
/**
* Tests checkArea() method.
*/
@Test
public void testCheckArea() throws Exception {
controller.updateConfig(ospfProcesses);
assertThat(controller.checkArea("10.10.10.10", "2.2.2.2"), is(true));
}
/**
* Tests checkArea() method.
*/
@Test
public void testCheckArea1() throws Exception {
controller.updateConfig(ospfProcesses);
assertThat(controller.checkArea("10.10.10.10", "111.111.111.111"), is(false));
}
/**
* Tests checkProcess() method.
*/
@Test
public void testCheckProcess() throws Exception {
controller.updateConfig(ospfProcesses);
assertThat(controller.checkProcess("3.3.3.3"), is(false));
assertThat(controller.checkProcess("1.1.1.1"), is(false));
}
/**
* Tests checkInterface() method.
*/
@Test
public void testCheckInterface() throws Exception {
controller.updateConfig(ospfProcesses);
assertThat(controller.checkInterface("10.10.10.10", "2.2.2.2", "1.1.1.1"), is(true));
}
/**
* Tests updateAreaInProcess() method.
*/
@Test
public void testUpdateAreaInProcess() throws Exception {
controller.updateConfig(ospfProcesses);
controller.updateAreaInProcess("10.10.10.10", "2.2.2.2", ospfArea);
assertThat(controller, is(notNullValue()));
}
/**
* Tests updateConfig() method.
*/
@Test
public void testUpdateConfig() throws Exception {
controller.updateConfig(ospfProcesses);
controller.updateConfig(ospfProcesses);
controller.updateConfig(ospfProcesses);
assertThat(controller, is(notNullValue()));
}
/**
* Tests updateConfig() method.
*/
@Test
public void testUpdateConfig2() throws Exception {
controller.updateConfig(ospfProcesses);
controller.updateConfig(ospfProcesses);
assertThat(controller, is(notNullValue()));
}
/**
* Tests updateConfig() method.
*/
@Test
public void testUpdateConfig1() throws Exception {
ospfProcess = new OspfProcessImpl();
ospfArea = new OspfAreaImpl();
ospfInterface = new OspfInterfaceImpl();
ospfInterfaces = new ArrayList();
ospfInterface.setIpAddress(Ip4Address.valueOf("10.10.10.5"));
ospfInterfaces.add(ospfInterface);
ospfArea.setAreaId(Ip4Address.valueOf("2.2.2.2"));
ospfArea.setInterfacesLst(ospfInterfaces);
ospfProcess.setProcessId("10.10.10.10");
ospfAreas = new ArrayList();
ospfAreas.add(ospfArea);
ospfProcess.setAreas(ospfAreas);
ospfProcesses = new ArrayList();
ospfProcesses.add(ospfProcess);
controller.updateConfig(ospfProcesses);
assertThat(controller, is(notNullValue()));
}
/**
* Tests deleteConfig() method.
*/
@Test(expected = Exception.class)
public void testDeleteConfig() throws Exception {
controller.updateConfig(ospfProcesses);
controller.deleteConfig(ospfProcesses, "INTERFACE");
assertThat(controller, is(notNullValue()));
}
/**
* Tests deleteConfig() method.
*/
@Test(expected = Exception.class)
public void testDeleteConfig1() throws Exception {
controller.updateConfig(ospfProcesses);
controller.deleteConfig(ospfProcesses, "AREA");
assertThat(controller, is(notNullValue()));
}
/**
* Tests deleteConfig() method.
*/
@Test
public void testDeleteConfig2() throws Exception {
controller.updateConfig(ospfProcesses);
controller.deleteConfig(ospfProcesses, "PROCESS");
assertThat(controller, is(notNullValue()));
}
/**
* Tests deleteConfig() method.
*/
@Test
public void testDeleteConfig3() throws Exception {
ospfProcesses = new ArrayList();
controller.deleteConfig(ospfProcesses, "PROCESS");
assertThat(controller, is(notNullValue()));
}
/**
* Tests deleteConfig() method.
*/
@Test
public void testDeleteConfig4() throws Exception {
controller.updateConfig(ospfProcesses);
controller.deleteConfig(ospfProcesses, "PROCESS");
controller.updateConfig(ospfProcesses);
assertThat(controller, is(notNullValue()));
}
/**
* Tests deleteProcessWhenExists() method.
*/
@Test
public void testDeleteProcessWhenExists() throws Exception {
controller.updateConfig(ospfProcesses);
controller.deleteProcessWhenExists(ospfProcesses, "PROCESS");
}
/**
* Tests addLinkDetails() method.
*/
@Test
public void testAddLinkDetails() throws Exception {
ospfAgent = EasyMock.createMock(OspfAgent.class);
controller.start(ospfAgent, driverService);
ospfRouter = new OspfRouterImpl();
controller.addLinkDetails(ospfRouter, new OspfLinkTedImpl());
assertThat(controller, is(notNullValue()));
}
/**
* Tests removeLinkDetails() method.
*/
@Test
public void testRemoveLinkDetails() throws Exception {
ospfAgent = EasyMock.createMock(OspfAgent.class);
controller.start(ospfAgent, driverService);
ospfRouter = new OspfRouterImpl();
controller.addLinkDetails(ospfRouter, new OspfLinkTedImpl());
controller.removeLinkDetails(ospfRouter);
assertThat(controller, is(notNullValue()));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
* Unit test class for DeviceInformationImpl.
*/
public class DeviceInformationImplTest {
private DeviceInformationImpl deviceInformation;
@Before
public void setUp() throws Exception {
deviceInformation = new DeviceInformationImpl();
}
@After
public void tearDown() throws Exception {
deviceInformation = null;
}
/**
* Tests routerId() getter method.
*/
@Test
public void testRouterId() throws Exception {
deviceInformation.setRouterId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.routerId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests routerId() setter method.
*/
@Test
public void testSetRouterId() throws Exception {
deviceInformation.setRouterId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.routerId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests deviceId() getter method.
*/
@Test
public void testDeviceId() throws Exception {
deviceInformation.setDeviceId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.deviceId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests deviceId() getter method.
*/
@Test
public void testSetDeviceId() throws Exception {
deviceInformation.setDeviceId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.deviceId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests interfaceId() method.
*/
@Test
public void testInterfaceId() throws Exception {
deviceInformation.addInterfaceId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.interfaceId().size(), is(1));
}
/**
* Tests addInterfaceId() method.
*/
@Test
public void testAddInterfaceId() throws Exception {
deviceInformation.addInterfaceId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.interfaceId().size(), is(1));
}
/**
* Tests areaId() getter method.
*/
@Test
public void testAreaId() throws Exception {
deviceInformation.setAreaId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.areaId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests areaId() setter method.
*/
@Test
public void testSetAreaId() throws Exception {
deviceInformation.setAreaId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.areaId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests isAlreadyCreated() getter method.
*/
@Test
public void testIsAlreadyCreated() throws Exception {
deviceInformation.setAlreadyCreated(true);
assertThat(deviceInformation.isAlreadyCreated(), is(true));
}
/**
* Tests isAlreadyCreated() setter method.
*/
@Test
public void testSetAlreadyCreated() throws Exception {
deviceInformation.setAlreadyCreated(true);
assertThat(deviceInformation.isAlreadyCreated(), is(true));
}
/**
* Tests isDr() getter method.
*/
@Test
public void testIsDr() throws Exception {
deviceInformation.setDr(true);
assertThat(deviceInformation.isDr(), is(true));
}
/**
* Tests isDr() setter method.
*/
@Test
public void testSetDr() throws Exception {
deviceInformation.setDr(true);
assertThat(deviceInformation.isDr(), is(true));
}
/**
* Tests neighborId() getter method.
*/
@Test
public void testNeighborId() throws Exception {
deviceInformation.setNeighborId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.neighborId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests neighborId() setter method.
*/
@Test
public void testSetNeighborId() throws Exception {
deviceInformation.setNeighborId(Ip4Address.valueOf("1.1.1.1"));
assertThat(deviceInformation.neighborId(), is(Ip4Address.valueOf("1.1.1.1")));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
* Unit test class for LinkInformationImpl.
*/
public class LinkInformationImplTest {
private LinkInformationImpl linkInformation;
@Before
public void setUp() throws Exception {
linkInformation = new LinkInformationImpl();
}
@After
public void tearDown() throws Exception {
linkInformation = null;
}
/**
* Tests linkId() getter method.
*/
@Test
public void testLinkId() throws Exception {
linkInformation.setLinkId("1.1.1.1");
assertThat(linkInformation.linkId(), is("1.1.1.1"));
}
/**
* Tests linkId() setter method.
*/
@Test
public void testSetLinkId() throws Exception {
linkInformation.setLinkId("1.1.1.1");
assertThat(linkInformation.linkId(), is("1.1.1.1"));
}
/**
* Tests isAlreadyCreated() getter method.
*/
@Test
public void testIsAlreadyCreated() throws Exception {
linkInformation.setAlreadyCreated(true);
assertThat(linkInformation.isAlreadyCreated(), is(true));
}
/**
* Tests isAlreadyCreated() setter method.
*/
@Test
public void testSetAlreadyCreated() throws Exception {
linkInformation.setAlreadyCreated(true);
assertThat(linkInformation.isAlreadyCreated(), is(true));
}
/**
* Tests isLinkSrcIdNotRouterId() getter method.
*/
@Test
public void testIsLinkSrcIdNotRouterId() throws Exception {
linkInformation.setLinkSrcIdNotRouterId(true);
assertThat(linkInformation.isLinkSrcIdNotRouterId(), is(true));
}
/**
* Tests isLinkSrcIdNotRouterId() setter method.
*/
@Test
public void testSetLinkSrcIdNotRouterId() throws Exception {
linkInformation.setLinkSrcIdNotRouterId(true);
assertThat(linkInformation.isLinkSrcIdNotRouterId(), is(true));
}
/**
* Tests linkDestinationId() getter method.
*/
@Test
public void testLinkDestinationId() throws Exception {
linkInformation.setLinkDestinationId(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.linkDestinationId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests linkDestinationId() setter method.
*/
@Test
public void testSetLinkDestinationId() throws Exception {
linkInformation.setLinkDestinationId(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.linkDestinationId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests linkSourceId() getter method.
*/
@Test
public void testLinkSourceId() throws Exception {
linkInformation.setLinkSourceId(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.linkSourceId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests linkSourceId() setter method.
*/
@Test
public void testSetLinkSourceId() throws Exception {
linkInformation.setLinkSourceId(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.linkSourceId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests interfaceIp() getter method.
*/
@Test
public void testInterfaceIp() throws Exception {
linkInformation.setInterfaceIp(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.interfaceIp(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests interfaceIp() setter method.
*/
@Test
public void testSetInterfaceIp() throws Exception {
linkInformation.setInterfaceIp(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.interfaceIp(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests linkSourceIpAddress() getter method.
*/
@Test
public void testLinkSourceIpAddress() throws Exception {
linkInformation.setLinkSourceIpAddress(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.linkSourceIpAddress(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests linkSourceIpAddress() setter method.
*/
@Test
public void testSetLinkSourceIpAddress() throws Exception {
linkInformation.setLinkSourceIpAddress(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.linkSourceIpAddress(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests linkDestinationId() getter method.
*/
@Test
public void testLinkDestinationIpAddress() throws Exception {
linkInformation.setLinkDestinationIpAddress(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.linkDestinationIpAddress(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests linkDestinationId() setter method.
*/
@Test
public void testSetLinkDestinationIpAddress() throws Exception {
linkInformation.setLinkDestinationIpAddress(Ip4Address.valueOf("1.1.1.1"));
assertThat(linkInformation.linkDestinationIpAddress(), is(Ip4Address.valueOf("1.1.1.1")));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onosproject.ospf.controller.OspfArea;
import org.onosproject.ospf.controller.OspfInterface;
import org.onosproject.ospf.controller.OspfLinkListener;
import org.onosproject.ospf.controller.OspfProcess;
import org.onosproject.ospf.controller.OspfRouter;
import org.onosproject.ospf.controller.OspfRouterListener;
import org.onosproject.ospf.controller.area.OspfAreaImpl;
import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
import org.onosproject.ospf.controller.area.OspfProcessImpl;
import java.util.ArrayList;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for OspfRouterId.
*/
public class OspfControllerImplTest {
private OspfControllerImpl ospfController;
private OspfRouterListener ospfRouterListener;
private OspfLinkListener ospfLinkListener;
private Controller controller;
private List<OspfProcess> ospfProcesses;
private OspfProcess process1;
private OspfProcess process2;
private List<OspfArea> areas;
private OspfAreaImpl ospfArea;
private List<OspfInterface> ospfInterfaces;
private OspfInterfaceImpl ospfInterface;
private OspfProcess ospfProcess;
private OspfArea ospfArea1;
private OspfRouter ospfRouter;
@Before
public void setUp() throws Exception {
ospfController = new OspfControllerImpl();
controller = new Controller();
}
@After
public void tearDown() throws Exception {
ospfController = null;
ospfRouterListener = null;
ospfLinkListener = null;
controller = null;
ospfProcesses = null;
areas = null;
ospfArea = null;
ospfInterfaces = null;
ospfInterface = null;
ospfProcess = null;
ospfProcess = null;
ospfArea1 = null;
ospfRouter = null;
}
/**
* Tests activate() method.
*/
@Test
public void testActivate() throws Exception {
ospfController.activate();
assertThat(ospfController, is(notNullValue()));
}
@Test(expected = Exception.class)
public void testDeactivate() throws Exception {
ospfController.activate();
ospfController.deactivate();
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests addRouterListener() method.
*/
@Test
public void testAddRouterListener() throws Exception {
ospfRouterListener = EasyMock.createMock(OspfRouterListener.class);
ospfController.addRouterListener(ospfRouterListener);
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests removeRouterListener() method.
*/
@Test
public void testRemoveRouterListener() throws Exception {
ospfRouterListener = EasyMock.createMock(OspfRouterListener.class);
ospfController.addRouterListener(ospfRouterListener);
ospfController.removeRouterListener(ospfRouterListener);
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests addLinkListener() method.
*/
@Test
public void testAddLinkListener() throws Exception {
ospfLinkListener = EasyMock.createMock(OspfLinkListener.class);
ospfController.addLinkListener(ospfLinkListener);
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests removeLinkListener() method.
*/
@Test
public void testRemoveLinkListener() throws Exception {
ospfLinkListener = EasyMock.createMock(OspfLinkListener.class);
ospfController.addLinkListener(ospfLinkListener);
ospfController.removeLinkListener(ospfLinkListener);
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests updateConfig() method.
*/
@Test
public void testUpdateConfig() throws Exception {
ospfProcess = new OspfProcessImpl();
ospfArea = new OspfAreaImpl();
ospfInterface = new OspfInterfaceImpl();
ospfInterfaces = new ArrayList();
ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
ospfInterfaces.add(ospfInterface);
ospfArea.setAreaId(Ip4Address.valueOf("2.2.2.2"));
ospfArea.setInterfacesLst(ospfInterfaces);
ospfProcess.setProcessId("10.10.10.10");
areas = new ArrayList();
areas.add(ospfArea);
ospfProcess.setAreas(areas);
ospfProcesses = new ArrayList();
ospfProcesses.add(ospfProcess);
process1 = new OspfProcessImpl();
process1.setProcessId("11.11.11.11");
ospfArea1 = new OspfAreaImpl();
ospfArea1.setAreaId(Ip4Address.valueOf("2.2.2.2"));
ospfArea1.setInterfacesLst(ospfInterfaces);
areas.add(ospfArea1);
process1.setAreas(areas);
ospfProcesses.add(process1);
ospfController.updateConfig(ospfProcesses);
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests deleteConfig() method.
*/
@Test
public void testDeleteConfig() throws Exception {
ospfProcess = new OspfProcessImpl();
ospfArea = new OspfAreaImpl();
ospfInterface = new OspfInterfaceImpl();
ospfInterfaces = new ArrayList();
ospfInterface.setIpAddress(Ip4Address.valueOf("10.10.10.5"));
ospfInterfaces.add(ospfInterface);
ospfArea.setAreaId(Ip4Address.valueOf("2.2.2.2"));
ospfArea.setInterfacesLst(ospfInterfaces);
ospfProcess.setProcessId("10.10.10.10");
areas = new ArrayList();
areas.add(ospfArea);
ospfProcess.setAreas(areas);
ospfProcesses = new ArrayList();
ospfProcesses.add(ospfProcess);
process1 = new OspfProcessImpl();
process1.setProcessId("11.11.11.11");
ospfArea1 = new OspfAreaImpl();
ospfArea1.setAreaId(Ip4Address.valueOf("2.2.2.2"));
ospfArea1.setInterfacesLst(ospfInterfaces);
areas.add(ospfArea1);
process1.setAreas(areas);
ospfProcesses.add(process1);
ospfController.deleteConfig(ospfProcesses, "INTERFACE");
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests addLink() method.
*/
@Test
public void testAddLink() throws Exception {
ospfRouter = new OspfRouterImpl();
ospfController.agent.addLink(ospfRouter, new OspfLinkTedImpl());
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests deleteLink() method.
*/
@Test
public void testDeleteLink() throws Exception {
ospfRouter = new OspfRouterImpl();
ospfController.agent.addLink(ospfRouter, new OspfLinkTedImpl());
ospfController.agent.deleteLink(ospfRouter);
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests listener() method.
*/
@Test
public void testListener() throws Exception {
assertThat(ospfController.listener().size(), is(0));
}
/**
* Tests linkListener() method.
*/
@Test
public void testLinkListener() throws Exception {
assertThat(ospfController.linkListener().size(), is(0));
}
/**
* Tests addConnectedRouter() method.
*/
@Test
public void testaddConnectedRouter() throws Exception {
ospfRouter = new OspfRouterImpl();
ospfController.agent.addConnectedRouter(ospfRouter);
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests removeConnectedRouter() method.
*/
@Test
public void testRemoveConnectedRouter() throws Exception {
ospfRouter = new OspfRouterImpl();
ospfController.agent.addConnectedRouter(ospfRouter);
ospfController.agent.removeConnectedRouter(ospfRouter);
assertThat(ospfController, is(notNullValue()));
}
/**
* Tests getAllConfiguredProcesses() method.
*/
@Test(expected = Exception.class)
public void testGetAllConfiguredProcesses() throws Exception {
assertThat(ospfController.getAllConfiguredProcesses().size(), is(0));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
* Unit test class for OspfDeviceTedImpl.
*/
public class OspfDeviceTedImplTest {
private OspfDeviceTedImpl ospfDeviceTed;
@Before
public void setUp() throws Exception {
ospfDeviceTed = new OspfDeviceTedImpl();
}
@After
public void tearDown() throws Exception {
ospfDeviceTed = null;
}
/**
* Tests ipv4RouterIds() getter method.
*/
@Test
public void testIpv4RouterIds() throws Exception {
List list = new ArrayList();
list.add(Ip4Address.valueOf("1.1.1.1"));
ospfDeviceTed.setIpv4RouterIds(list);
assertThat(ospfDeviceTed.ipv4RouterIds().size(), is(1));
}
/**
* Tests ipv4RouterIds() setter method.
*/
@Test
public void testSetIpv4RouterIds() throws Exception {
List list = new ArrayList();
list.add(Ip4Address.valueOf("1.1.1.1"));
ospfDeviceTed.setIpv4RouterIds(list);
assertThat(ospfDeviceTed.ipv4RouterIds().size(), is(1));
}
/**
* Tests abr() getter method.
*/
@Test
public void testAbr() throws Exception {
ospfDeviceTed.setAbr(true);
assertThat(ospfDeviceTed.abr(), is(true));
}
/**
* Tests abr() setter method.
*/
@Test
public void testSetAbr() throws Exception {
ospfDeviceTed.setAbr(true);
assertThat(ospfDeviceTed.abr(), is(true));
}
/**
* Tests asbr() getter method.
*/
@Test
public void testAsbr() throws Exception {
ospfDeviceTed.setAsbr(true);
assertThat(ospfDeviceTed.asbr(), is(true));
}
/**
* Tests asbr() setter method.
*/
@Test
public void testSetAsbr() throws Exception {
ospfDeviceTed.setAsbr(true);
assertThat(ospfDeviceTed.asbr(), is(true));
}
/**
* Tests topologyIds() getter method.
*/
@Test
public void testTopologyIds() throws Exception {
List list = new ArrayList();
list.add(Ip4Address.valueOf("1.1.1.1"));
ospfDeviceTed.setTopologyIds(list);
assertThat(ospfDeviceTed.topologyIds().size(), is(1));
}
/**
* Tests topologyIds() setter method.
*/
@Test
public void testSetTopologyIds() throws Exception {
List list = new ArrayList();
list.add(Ip4Address.valueOf("1.1.1.1"));
ospfDeviceTed.setTopologyIds(list);
assertThat(ospfDeviceTed.topologyIds().size(), is(1));
}
/**
* Tests ipv6RouterIds() getter method.
*/
@Test(expected = Exception.class)
public void testIpv6RouterIds() throws Exception {
List list = new ArrayList();
list.add(Ip6Address.valueOf(InetAddress.getLocalHost()));
ospfDeviceTed.setIpv6RouterIds(list);
assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1));
}
/**
* Tests ipv6RouterIds() setter method.
*/
@Test(expected = Exception.class)
public void testSetIpv6RouterIds() throws Exception {
List list = new ArrayList();
list.add(Ip6Address.valueOf(InetAddress.getLocalHost()));
ospfDeviceTed.setIpv6RouterIds(list);
assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onlab.util.Bandwidth;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
/**
* Unit test class for OspfDeviceTedImpl.
*/
public class OspfLinkTedImplTest {
private OspfLinkTedImpl ospfLinkTed;
@Before
public void setUp() throws Exception {
ospfLinkTed = new OspfLinkTedImpl();
}
@After
public void tearDown() throws Exception {
ospfLinkTed = null;
}
/**
* Tests maximumLink() getter method.
*/
@Test
public void testMaximumLink() throws Exception {
ospfLinkTed.setMaximumLink(Bandwidth.bps(1234));
assertThat(ospfLinkTed.maximumLink(), is(Bandwidth.bps(1234)));
}
/**
* Tests maximumLink() setter method.
*/
@Test
public void testSetMaximumLink() throws Exception {
ospfLinkTed.setMaximumLink(Bandwidth.bps(1234));
assertThat(ospfLinkTed.maximumLink(), is(Bandwidth.bps(1234)));
}
/**
* Tests ipv6RemRouterId() getter method.
*/
@Test
public void testIpv6RemRouterId() throws Exception {
List list = new ArrayList();
ospfLinkTed.setIpv6RemRouterId(list);
assertThat(ospfLinkTed.ipv6RemRouterId().size(), is(0));
}
/**
* Tests ipv6RemRouterId() setter method.
*/
@Test
public void testSetIpv6RemRouterId() throws Exception {
List list = new ArrayList();
ospfLinkTed.setIpv6RemRouterId(list);
assertThat(ospfLinkTed.ipv6RemRouterId().size(), is(0));
}
/**
* Tests ipv4RemRouterId() getter method.
*/
@Test
public void testIpv4RemRouterId() throws Exception {
List list = new ArrayList();
list.add(Ip4Address.valueOf(InetAddress.getLocalHost()));
ospfLinkTed.setIpv4RemRouterId(list);
assertThat(ospfLinkTed.ipv4RemRouterId().size(), is(1));
}
/**
* Tests ipv4RemRouterId() setter method.
*/
@Test
public void testSetIpv4RemRouterId() throws Exception {
List list = new ArrayList();
list.add(Ip4Address.valueOf(InetAddress.getLocalHost()));
ospfLinkTed.setIpv4RemRouterId(list);
assertThat(ospfLinkTed.ipv4RemRouterId().size(), is(1));
}
/**
* Tests ipv6LocRouterId() getter method.
*/
@Test
public void testIpv6LocRouterId() throws Exception {
List list = new ArrayList();
ospfLinkTed.setIpv4LocRouterId(list);
assertThat(ospfLinkTed.ipv6LocRouterId().size(), is(0));
}
/**
* Tests ipv6LocRouterId() setter method.
*/
@Test
public void testSetIpv6LocRouterId() throws Exception {
List list = new ArrayList();
ospfLinkTed.setIpv4LocRouterId(list);
assertThat(ospfLinkTed.ipv6LocRouterId().size(), is(0));
}
/**
* Tests ipv4LocRouterId() getter method.
*/
@Test
public void testIpv4LocRouterId() throws Exception {
List list = new ArrayList();
list.add(Ip4Address.valueOf(InetAddress.getLocalHost()));
ospfLinkTed.setIpv4LocRouterId(list);
assertThat(ospfLinkTed.ipv4LocRouterId().size(), is(1));
}
/**
* Tests ipv4LocRouterId() setter method.
*/
@Test
public void testSetIpv4LocRouterId() throws Exception {
List list = new ArrayList();
list.add(Ip4Address.valueOf(InetAddress.getLocalHost()));
ospfLinkTed.setIpv4LocRouterId(list);
assertThat(ospfLinkTed.ipv4LocRouterId().size(), is(1));
}
/**
* Tests teMetric() getter method.
*/
@Test
public void testTeMetric() throws Exception {
ospfLinkTed.setTeMetric(1234);
assertThat(ospfLinkTed.teMetric(), is(1234));
}
/**
* Tests teMetric() setter method.
*/
@Test
public void testSetTeMetric() throws Exception {
ospfLinkTed.setTeMetric(1234);
assertThat(ospfLinkTed.teMetric(), is(1234));
}
/**
* Tests maxReserved() getter method.
*/
@Test
public void testMaxReserved() throws Exception {
ospfLinkTed.setMaxReserved(Bandwidth.bps(1234));
assertThat(ospfLinkTed.maxReserved(), is(Bandwidth.bps(1234)));
}
/**
* Tests maxReserved() setter method.
*/
@Test
public void testSetMaxReserved() throws Exception {
ospfLinkTed.setMaxReserved(Bandwidth.bps(1234));
assertThat(ospfLinkTed.maxReserved(), is(Bandwidth.bps(1234)));
}
/**
* Tests maxUnResBandwidth() getter method.
*/
@Test
public void testMaxUnResBandwidth() throws Exception {
ospfLinkTed.setMaxUnResBandwidth(Bandwidth.bps(1234));
assertThat(ospfLinkTed.maxUnResBandwidth(), is(notNullValue()));
}
/**
* Tests maxUnResBandwidth() setter method.
*/
@Test
public void testSetMaxUnResBandwidth() throws Exception {
ospfLinkTed.setMaxUnResBandwidth(Bandwidth.bps(1234.0));
assertThat(ospfLinkTed.maxUnResBandwidth(), is(notNullValue()));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.easymock.EasyMock;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for OspfMessageDecoder.
*/
public class OspfMessageDecoderTest {
private final byte[] hellopacket = {0, 0, 0, 0, 2, 1, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, 39, 59,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 10, 2, 1, 0, 0, 0,
40, -64, -88, -86, 8, 0, 0, 0, 0};
private final byte[] ddpacket = {0, 0, 0, 0, 2, 2, 0, 32, -64, -88, -86, 8, 0, 0, 0, 1, -96, 82,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, -36, 2, 7, 65, 119, -87, 126};
private final byte[] ddpacket44 = {0, 0, 0, 0, 2, 2, 0, 10, -64, -88};
private final byte[] lsAckpacket = {0, 0, 0, 0, 2, 5, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, -30, -12,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 16, 2, 1, -64, -88, -86, 2, -64,
-88, -86, 2, -128, 0, 0, 1, 74, -114, 0, 48};
private final byte[] lsUpdatePacket = {0, 0, 0, 0, 2, 4, 0, 76, -64, -88, -86, 3, 0, 0, 0, 1, 7, 111,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 14, 16, 2, 1, -64, -88,
-86, 2, -64, -88, -86, 2, -128, 0, 0, 1, 74, -114, 0, 48, 2, 0, 0, 2
, -64, -88, -86, 0, -1, -1, -1, 0, 3, 0, 0, 10, -64, -88, -86, 0, -1, -1, -1, 0, 3, 0, 0, 10};
private final byte[] lsRequestPacket = {0, 0, 0, 0, 2, 3, 0, 36, -64, -88, -86, 3, 0, 0, 0, 1, -67, -57,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -64, -88, -86, 8, -64, -88, -86, 8};
private OspfMessageDecoder ospfMessageDecoder;
private ChannelHandlerContext ctx;
private Channel channel;
private SocketAddress socketAddress;
private ChannelBuffer channelBuffer;
@Before
public void setUp() throws Exception {
ospfMessageDecoder = new OspfMessageDecoder();
}
@After
public void tearDown() throws Exception {
ospfMessageDecoder = null;
channel = null;
socketAddress = null;
channelBuffer = null;
}
/**
* Tests decode() method.
*/
@Test
public void testDecode() throws Exception {
channel = EasyMock.createMock(Channel.class);
socketAddress = InetSocketAddress.createUnresolved("127.0.0.1", 7000);
channelBuffer = ChannelBuffers.copiedBuffer(hellopacket);
assertThat(ospfMessageDecoder.decode(ctx, channel, channelBuffer), is(nullValue()));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.easymock.EasyMock;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
import org.onosproject.ospf.protocol.ospfpacket.types.DdPacket;
import org.onosproject.ospf.protocol.ospfpacket.types.HelloPacket;
import org.onosproject.ospf.protocol.ospfpacket.types.LsAcknowledge;
import org.onosproject.ospf.protocol.ospfpacket.types.LsRequest;
import org.onosproject.ospf.protocol.ospfpacket.types.LsUpdate;
import org.onosproject.ospf.protocol.util.OspfInterfaceState;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Created by sdn on 13/1/16.
*/
public class OspfMessageEncoderTest {
private final byte[] hpacket = {2, 1, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, 39, 59,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 10, 2, 1, 0, 0, 0,
40, -64, -88, -86, 8, 0, 0, 0, 0};
private final byte[] dpacket = {2, 2, 0, 32, -64, -88, -86, 8, 0, 0, 0, 1, -96, 82,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, -36, 2, 7, 65, 119, -87, 126};
private final byte[] lrpacket = {2, 3, 0, 36, -64, -88, -86, 3, 0, 0, 0, 1, -67, -57,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -64, -88, -86, 8, -64, -88, -86, 8};
private byte[] lAckpacket = {2, 5, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, -30, -12,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 16, 2, 1, -64, -88, -86, 2, -64,
-88, -86, 2, -128, 0, 0, 1, 74, -114, 0, 48};
private HelloPacket helloPacket;
private DdPacket ddPacket;
private LsAcknowledge lsAcknowledge;
private LsRequest lsRequest;
private LsUpdate lsUpdate;
private ChannelHandlerContext ctx;
private OspfMessageEncoder ospfMessageEncoder;
private ChannelBuffer buf;
private SocketAddress socketAddress;
private Channel channel;
@Before
public void setUp() throws Exception {
ospfMessageEncoder = new OspfMessageEncoder();
helloPacket = new HelloPacket();
ddPacket = new DdPacket();
lsAcknowledge = new LsAcknowledge();
lsRequest = new LsRequest();
lsUpdate = new LsUpdate();
helloPacket.setOspftype(1);
ddPacket.setOspftype(2);
lsAcknowledge.setOspftype(5);
lsRequest.setOspftype(3);
lsUpdate.setOspftype(4);
OspfInterfaceImpl ospfInterface = new OspfInterfaceImpl();
ospfInterface.setState(OspfInterfaceState.DROTHER);
ospfMessageEncoder = new OspfMessageEncoder(ospfInterface);
}
@After
public void tearDown() throws Exception {
helloPacket = null;
ddPacket = null;
lsAcknowledge = null;
lsRequest = null;
lsUpdate = null;
ospfMessageEncoder = null;
buf = null;
}
/**
* Tests encode() method.
*/
@Test
public void testEncode() throws Exception {
socketAddress = InetSocketAddress.createUnresolved("127.0.0.1", 8600);
channel = EasyMock.createMock(Channel.class);
helloPacket = new HelloPacket();
helloPacket.setDestinationIp(Ip4Address.valueOf("15.15.15.15"));
buf = ChannelBuffers.buffer(hpacket.length);
buf.writeBytes(hpacket);
helloPacket.readFrom(buf);
ospfMessageEncoder.encode(ctx, channel, helloPacket);
ddPacket = new DdPacket();
ddPacket.setDestinationIp(Ip4Address.valueOf("15.15.15.15"));
buf = ChannelBuffers.buffer(dpacket.length);
buf.writeBytes(dpacket);
ddPacket.readFrom(buf);
ospfMessageEncoder.encode(ctx, channel, ddPacket);
lsRequest = new LsRequest();
lsRequest.setDestinationIp(Ip4Address.valueOf("15.15.15.15"));
buf = ChannelBuffers.buffer(lrpacket.length);
buf.writeBytes(lrpacket);
lsRequest.readFrom(buf);
ospfMessageEncoder.encode(ctx, channel, lsRequest);
lsAcknowledge = new LsAcknowledge();
lsAcknowledge.setDestinationIp(Ip4Address.valueOf("15.15.15.15"));
buf = ChannelBuffers.buffer(lAckpacket.length);
buf.writeBytes(lAckpacket);
lsAcknowledge.readFrom(buf);
ospfMessageEncoder.encode(ctx, channel, lsAcknowledge);
assertThat(ospfMessageEncoder, is(notNullValue()));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.jboss.netty.channel.ChannelPipeline;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onosproject.ospf.controller.area.OspfAreaImpl;
import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for OspfPipelineFactory.
*/
public class OspfPipelineFactoryTest {
private OspfPipelineFactory ospfPipelineFactory;
private ChannelPipeline channelPipeline;
@Before
public void setUp() throws Exception {
ospfPipelineFactory = new OspfPipelineFactory(new Controller(), new OspfAreaImpl(), new OspfInterfaceImpl());
}
@After
public void tearDown() throws Exception {
ospfPipelineFactory = null;
channelPipeline = null;
}
/**
* Tests getPipeline() method.
*/
@Test
public void testGetPipeline() throws Exception {
channelPipeline = ospfPipelineFactory.getPipeline();
assertThat(channelPipeline, is(notNullValue()));
}
/**
* Tests releaseExternalResources() method.
*/
@Test
public void testReleaseExternalResources() throws Exception {
ospfPipelineFactory.releaseExternalResources();
assertThat(channelPipeline, is(nullValue()));
}
}
\ No newline at end of file
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ospf.controller.impl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.IpAddress;
import org.onosproject.ospf.controller.OspfDeviceTed;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for OspfRouterImpl.
*/
public class OspfRouterImplTest {
private OspfRouterImpl ospfRouter;
private OspfDeviceTed ospfDeviceTed;
private List<OspfDeviceTed> list;
@Before
public void setUp() throws Exception {
ospfRouter = new OspfRouterImpl();
}
@After
public void tearDown() throws Exception {
ospfRouter = null;
}
/**
* Tests routerIp() getter method.
*/
@Test
public void testRouterIp() throws Exception {
ospfRouter.setRouterIp(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfRouter.routerIp(), is(IpAddress.valueOf("1.1.1.1")));
}
/**
* Tests routerIp() setter method.
*/
@Test
public void testSetRouterIp() throws Exception {
ospfRouter.setRouterIp(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfRouter.routerIp(), is(IpAddress.valueOf("1.1.1.1")));
}
/**
* Tests areaIdOfInterface() getter method.
*/
@Test
public void testAreaIdOfInterface() throws Exception {
ospfRouter.setAreaIdOfInterface(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfRouter.areaIdOfInterface(), is(IpAddress.valueOf("1.1.1.1")));
}
/**
* Tests areaIdOfInterface() setter method.
*/
@Test
public void testSetAreaIdOfInterface() throws Exception {
ospfRouter.setAreaIdOfInterface(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfRouter.areaIdOfInterface(), is(IpAddress.valueOf("1.1.1.1")));
}
/**
* Tests interfaceId() getter method.
*/
@Test
public void testInterfaceId() throws Exception {
ospfRouter.setInterfaceId(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfRouter.interfaceId(), is(IpAddress.valueOf("1.1.1.1")));
}
/**
* Tests interfaceId() setter method.
*/
@Test
public void testSetInterfaceId() throws Exception {
ospfRouter.setInterfaceId(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfRouter.interfaceId(), is(IpAddress.valueOf("1.1.1.1")));
}
/**
* Tests isDr() setter method.
*/
@Test
public void testSetDr() throws Exception {
ospfRouter.setDr(true);
assertThat(ospfRouter.isDr(), is(true));
}
/**
* Tests isDr() getter method.
*/
@Test
public void testIsDr() throws Exception {
ospfRouter.setDr(true);
assertThat(ospfRouter.isDr(), is(true));
}
/**
* Tests isOpaque() setter method.
*/
@Test
public void testSetOpaque() throws Exception {
ospfRouter.setOpaque(true);
assertThat(ospfRouter.isOpaque(), is(true));
}
/**
* Tests isOpaque() getter method.
*/
@Test
public void testisOpaque() throws Exception {
ospfRouter.setOpaque(true);
assertThat(ospfRouter.isOpaque(), is(true));
}
/**
* Tests deviceTed() getter method.
*/
@Test
public void testDeviceTed() throws Exception {
ospfRouter.setDeviceTed(new OspfDeviceTedImpl());
assertThat(ospfRouter.deviceTed(), is(notNullValue()));
}
/**
* Tests deviceTed() Setter method.
*/
@Test
public void testSetDeviceTed() throws Exception {
ospfRouter.setDeviceTed(new OspfDeviceTedImpl());
assertThat(ospfRouter.deviceTed(), is(notNullValue()));
}
/**
* Tests neighborRouterId() getter method.
*/
@Test
public void testNeighborRouterId() throws Exception {
ospfRouter.setNeighborRouterId(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfRouter.neighborRouterId(), is(Ip4Address.valueOf("1.1.1.1")));
}
/**
* Tests neighborRouterId() Setter method.
*/
@Test
public void testSetNeighborRouterId() throws Exception {
ospfRouter.setNeighborRouterId(Ip4Address.valueOf("1.1.1.1"));
assertThat(ospfRouter.neighborRouterId(), is(Ip4Address.valueOf("1.1.1.1")));
}
}
\ No newline at end of file