Exemplo n.º 1
0
 @Override
 public Class<? extends Port> getType(Topology.Port proto) {
   if (proto.hasVtepId()) return VxLanPort.class;
   else if (proto.hasNetworkId()) return BridgePort.class;
   else if (proto.hasRouterId()) return RouterPort.class;
   else throw new IllegalArgumentException("Unknown port type: " + proto);
 }
Exemplo n.º 2
0
  @Override
  public void delVirtualPortMapping(UUID hostId, UUID portId) {
    try {

      Topology.Port port = Await.result(backend.store().get(Topology.Port.class, portId), TIMEOUT);
      port = port.toBuilder().clearHostId().clearInterfaceName().build();

      backend.store().update(port);
    } catch (Exception e) {
      throw new RuntimeException("Failed to remove vrn port mapping");
    }
  }
Exemplo n.º 3
0
  @Override
  public void addVirtualPortMapping(UUID hostId, UUID portId, String ifcName) {
    try {

      Topology.Port port = Await.result(backend.store().get(Topology.Port.class, portId), TIMEOUT);
      port = port.toBuilder().setHostId(toProto(hostId)).setInterfaceName(ifcName).build();

      backend.store().update(port);
    } catch (Exception e) {
      throw new RuntimeException("Failed to add vrn port mapping");
    }
  }