Esempio n. 1
0
  /**
   * @param areaId
   * @param selectedAreaType
   * @return OSPFAreaConfiguration
   * @throws IOException
   */
  public static OSPFAreaConfiguration getOSPFAreaConfiguration(
      String areaId, AreaType selectedAreaType) throws IOException {
    OSPFArea area = new OSPFArea();
    area.setAreaID(ModelHelper.ipv4StringToLong(areaId));
    area.setAreaType(selectedAreaType);

    OSPFAreaConfiguration areaConfig = new OSPFAreaConfiguration();
    areaConfig.setOSPFArea(area);
    return areaConfig;
  }
Esempio n. 2
0
  private System removeOSPFServiceFromModel(System routerModel) {
    // get OSPFService
    OSPFService ospfService = null;
    for (Service service : routerModel.getHostedService()) {
      if (service instanceof OSPFService) ospfService = (OSPFService) service;
    }
    if (ospfService == null) return routerModel;

    // REMOVE ALL MODEL RELATED TO OSPF
    for (OSPFAreaConfiguration areaConf : ospfService.getOSPFAreaConfiguration()) {
      for (OSPFProtocolEndpointBase ospfPEP : areaConf.getOSPFArea().getEndpointsInArea()) {
        for (LogicalPort port : ospfPEP.getLogicalPorts()) {
          // unlink OSPFProtocolEndpoint with NetworkPorts.
          ospfPEP.removeLogicalPort(port);
        }
        areaConf.getOSPFArea().removeEndpointInArea(ospfPEP);
      }
      ospfService.removeOSPFAreaConfiguration(areaConf);
    }
    routerModel.removeHostedService(ospfService);
    return routerModel;
  }