jiangrui
Committed by Gerrit Code Review

[ONOS-2817]: add routerService and floatingIpService api

Change-Id: I87bc6e03036b08b932a5e2a9c1b4bd50e4358538
/*
* Copyright 2015 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.vtnrsc.floatingip;
import org.onosproject.event.AbstractEvent;
import org.onosproject.vtnrsc.FloatingIp;
/**
* Describes network Floating IP event.
*/
public class FloatingIpEvent
extends AbstractEvent<FloatingIpEvent.Type, FloatingIp> {
/**
* Type of Floating IP events.
*/
public enum Type {
/**
* Signifies that Floating IP has been created.
*/
FLOATINGIP_PUT,
/**
* Signifies that Floating IP has been deleted.
*/
FLOATINGIP_DELETE
}
/**
* Creates an event of a given type and for the specified Floating IP.
*
* @param type Floating IP event type
* @param floagingIp Floating IP subject
*/
public FloatingIpEvent(Type type, FloatingIp floagingIp) {
super(type, floagingIp);
}
/**
* Creates an event of a given type and for the specified Floating IP.
*
* @param type Floating IP event type
* @param floagingIp Floating IP subject
* @param time occurrence time
*/
public FloatingIpEvent(Type type, FloatingIp floagingIp, long time) {
super(type, floagingIp, time);
}
}
/*
* Copyright 2015 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.vtnrsc.floatingip;
import org.onosproject.event.EventListener;
/**
* Entity capable of Floating IP related events.
*/
public interface FloatingIpListener extends EventListener<FloatingIpEvent> {
}
/*
* Copyright 2015 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.vtnrsc.floatingip;
import java.util.Collection;
import org.onlab.packet.IpAddress;
import org.onosproject.vtnrsc.FloatingIp;
import org.onosproject.vtnrsc.FloatingIpId;
import org.onosproject.vtnrsc.TenantId;
/**
* Service for interacting with the inventory of floating IP.
*/
public interface FloatingIpService {
/**
* Returns exists or not of specific floatingIp identifier.
*
* @param floatingIpId floatingIp identifier
* @return true or false
*/
boolean exists(FloatingIpId floatingIpId);
/**
* Returns is used or not of specific floating IP address.
*
* @param floatingIpAddr floatingIp address
* @param floatingIpId floatingIp identifier
* @return true or false
*/
boolean floatingIpIsUsed(IpAddress floatingIpAddr, FloatingIpId floatingIpId);
/**
* Returns is used or not of specific fixed IP address.
*
* @param fixedIpAddr fixedIp address
* @param tenantId the tenant identifier of floating IP
* @param floatingIpId floatingIp identifier
* @return true or false
*/
boolean fixedIpIsUsed(IpAddress fixedIpAddr, TenantId tenantId, FloatingIpId floatingIpId);
/**
* Returns a collection of the currently known floating IP.
*
* @return collection of floating IP
*/
Collection<FloatingIp> getFloatingIps();
/**
* Returns the floatingIp with the specified identifier.
*
* @param floatingIpId floatingIp identifier
* @return floatingIp or null if one with the given identifier is not known
*/
FloatingIp getFloatingIp(FloatingIpId floatingIpId);
/**
* Creates new floatingIps.
*
* @param floatingIps the collection of floatingIp
* @return true if the identifier floatingIp has been created right
*/
boolean createFloatingIps(Collection<FloatingIp> floatingIps);
/**
* Updates existing floatingIps.
*
* @param floatingIps the collection of floatingIp
* @return true if all floatingIp were updated successfully
*/
boolean updateFloatingIps(Collection<FloatingIp> floatingIps);
/**
* Removes the specified floatingIp from the store.
*
* @param floatingIpIds the collection of floatingIp identifier
* @return true if remove identifier floatingIp successfully
*/
boolean removeFloatingIps(Collection<FloatingIpId> floatingIpIds);
/**
* Adds the specified listener to floating Ip manager.
*
* @param listener floating Ip listener
*/
void addListener(FloatingIpListener listener);
/**
* Removes the specified listener to floating Ip manager.
*
* @param listener floating Ip listener
*/
void removeListener(FloatingIpListener listener);
}
/*
* Copyright 2015 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.
*/
/**
* Service for interacting with the inventory of FloatingIp.
*/
package org.onosproject.vtnrsc.floatingip;
/*
* Copyright 2015 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.vtnrsc.router;
import org.onosproject.event.AbstractEvent;
import org.onosproject.vtnrsc.Router;
/**
* Describes network Router event.
*/
public class RouterEvent extends AbstractEvent<RouterEvent.Type, Router> {
/**
* Type of Router events.
*/
public enum Type {
/**
* Signifies that router has been created.
*/
ROUTER_PUT,
/**
* Signifies that router has been deleted.
*/
ROUTER_DELETE
}
/**
* Creates an event of a given type and for the specified Router.
*
* @param type Router event type
* @param router Router subject
*/
public RouterEvent(Type type, Router router) {
super(type, router);
}
/**
* Creates an event of a given type and for the specified Router.
*
* @param type Router event type
* @param router Router subject
* @param time occurrence time
*/
public RouterEvent(Type type, Router router, long time) {
super(type, router, time);
}
}
/*
* Copyright 2015 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.vtnrsc.router;
import org.onosproject.event.EventListener;
/**
* Entity capable of Router related events.
*/
public interface RouterListener extends EventListener<RouterEvent> {
}
/*
* Copyright 2015 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.vtnrsc.router;
import java.util.Collection;
import org.onosproject.vtnrsc.Router;
import org.onosproject.vtnrsc.RouterId;
/**
* Service for interacting with the inventory of Routers.
*/
public interface RouterService {
/**
* Returns exists or not of specific router identifier.
*
* @param routerId router identifier
* @return true or false
*/
boolean exists(RouterId routerId);
/**
* Returns a collection of the currently known Routers.
*
* @return collection of Routers
*/
Collection<Router> getRouters();
/**
* Returns the Router with the specified identifier.
*
* @param routerId Router identifier
* @return Router or null if one with the given identifier is not known
*/
Router getRouter(RouterId routerId);
/**
* Creates new Routers.
*
* @param routers the collection of Routers
* @return true if the identifier Router has been created right.
* false if the identifier Router is failed to store
*/
boolean createRouters(Collection<Router> routers);
/**
* Updates existing Routers.
*
* @param routers the collection of Routers
* @return true if Routers were updated successfully.
* false if Routers were updated failed
*/
boolean updateRouters(Collection<Router> routers);
/**
* Removes the specified Routers from the store.
*
* @param routerIds the collection of Routers identifier
* @return true if remove identifier Routers successfully. false if remove
* identifier Routers failed
*/
boolean removeRouters(Collection<RouterId> routerIds);
/**
* Adds the specified listener to Router manager.
*
* @param listener Router listener
*/
void addListener(RouterListener listener);
/**
* Removes the specified listener to Router manager.
*
* @param listener Router listener
*/
void removeListener(RouterListener listener);
}
/*
* Copyright 2015 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.
*/
/**
* Service for interacting with the inventory of Router.
*/
package org.onosproject.vtnrsc.router;
/*
* Copyright 2015 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.vtnrsc.routerinterface;
import org.onosproject.event.AbstractEvent;
import org.onosproject.vtnrsc.RouterInterface;
/**
* Describes network Router Interface event.
*/
public class RouterInterfaceEvent
extends AbstractEvent<RouterInterfaceEvent.Type, RouterInterface> {
/**
* Type of Router Interface events.
*/
public enum Type {
/**
* Signifies that router interface has been added.
*/
ROUTER_INTERFACE_PUT,
/**
* Signifies that router interface has been removed.
*/
ROUTER_INTERFACE_DELETE
}
/**
* Creates an event of a given type and for the specified Router Interface.
*
* @param type Router Interface event type
* @param routerInterface Router Interface subject
*/
public RouterInterfaceEvent(Type type, RouterInterface routerInterface) {
super(type, routerInterface);
}
/**
* Creates an event of a given type and for the specified Router Interface.
*
* @param type Router Interface event type.
* @param routerInterface Router Interface subject
* @param time occurrence time
*/
public RouterInterfaceEvent(Type type, RouterInterface routerInterface,
long time) {
super(type, routerInterface, time);
}
}
/*
* Copyright 2015 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.vtnrsc.routerinterface;
import org.onosproject.event.EventListener;
/**
* Entity capable of Router Interface related events.
*/
public interface RouterInterfaceListener
extends EventListener<RouterInterfaceEvent> {
}
/*
* Copyright 2015 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.vtnrsc.routerinterface;
import java.util.Collection;
import org.onosproject.vtnrsc.RouterInterface;
import org.onosproject.vtnrsc.SubnetId;
/**
* Service for interacting with the inventory of Router interface.
*/
public interface RouterInterfaceService {
/**
* Returns exists or not of specific subnet identifier.
*
* @param subnetId subnet identifier
* @return true or false
*/
boolean exists(SubnetId subnetId);
/**
* Returns a collection of the currently known Router interface.
*
* @return collection of RouterInterface
*/
Collection<RouterInterface> getRouterInterfaces();
/**
* Returns the Router interface with the specified subnet identifier.
*
* @param subnetId subnet identifier
* @return RouterInterface or null if one with the given identifier is not
* known
*/
RouterInterface getRouterInterface(SubnetId subnetId);
/**
* Adds the specified RouterInterface.
*
* @param routerInterface the interface add to router
* @return true if add router interface successfully
*/
boolean addRouterInterface(RouterInterface routerInterface);
/**
* Removes the specified RouterInterface.
*
* @param routerInterface the interface remove from router
* @return true if remove router interface successfully
*/
boolean removeRouterInterface(RouterInterface routerInterface);
/**
* Adds the specified listener to Router Interface manager.
*
* @param listener Router Interface listener
*/
void addListener(RouterInterfaceListener listener);
/**
* Removes the specified listener to RouterInterface manager.
*
* @param listener Router Interface listener
*/
void removeListener(RouterInterfaceListener listener);
}
/*
* Copyright 2015 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.
*/
/**
* Service for interacting with the inventory of RouterInterface.
*/
package org.onosproject.vtnrsc.routerinterface;
/*
* Copyright 2015 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.vtnrsc.service;
import java.util.Iterator;
import org.onlab.packet.MacAddress;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.HostId;
import org.onosproject.vtnrsc.SegmentationId;
import org.onosproject.vtnrsc.TenantId;
import org.onosproject.vtnrsc.VirtualPortId;
import org.onosproject.vtnrsc.event.VtnRscListener;
/**
* Service for interacting with the inventory of Vtn resource.
*/
public interface VtnRscService {
/**
* Adds the specified listener.
*
* @param listener VtnRsc listener
*/
void addListener(VtnRscListener listener);
/**
* Removes the specified listener.
*
* @param listener VtnRsc listener
*/
void removeListener(VtnRscListener listener);
/**
* Returns the SegmentationId of tenant.
*
* @param tenantId tenant identifier
* @return SegmentationId the SegmentationId of tenant
*/
SegmentationId getL3vni(TenantId tenantId);
/**
* Returns Classifier Ovs list of the specific tenant.
*
* @param tenantId tenant identifier
* @return iterable collection of Device
*/
Iterator<Device> getClassifierOfTenant(TenantId tenantId);
/**
* Returns Service function forwarders Ovs list of the specific tenant.
*
* @param tenantId tenant identifier
* @return iterable collection of Device
*/
Iterator<Device> getSFFOfTenant(TenantId tenantId);
/**
* Returns gateway mac address of the specific host.
*
* @param hostId host identifier
* @return MacAddress of host
*/
MacAddress getGatewayMac(HostId hostId);
/**
* Checks if a specific port is a service function.
*
* @param portId port identifier
* @return true or false
*/
boolean isServiceFunction(VirtualPortId portId);
/**
* Returns device identifier mapping to the specific port.
*
* @param portId port identifier
* @return device identifier
*/
DeviceId getSFToSFFMaping(VirtualPortId portId);
}
/*
* Copyright 2015 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.
*/
/**
* Service for interacting with the inventory of Vtn resource.
*/
package org.onosproject.vtnrsc.service;