Hook the OpenDaylight plugin into CloudStack

This commit is contained in:
Hugo Trippaers 2013-12-19 11:00:36 +01:00
parent 1f9528bad3
commit 850bc9fa82
9 changed files with 94 additions and 52 deletions

View File

@ -455,6 +455,11 @@ public class EventTypes {
//Alert generation
public static final String ALERT_GENERATE = "ALERT.GENERATE";
// OpenDaylight
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_ADD_CONTROLLER = "PHYSICAL.ODLCONTROLLER.ADD";
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_DELETE_CONTROLLER = "PHYSICAL.ODLCONTROLLER.DELETE";
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER = "PHYSICAL.ODLCONTROLLER.CONFIGURE";
static {
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@ -760,6 +765,11 @@ public class EventTypes {
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName());
entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class.getName());
// OpenDaylight
entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_ADD_CONTROLLER, "OpenDaylightController");
entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_DELETE_CONTROLLER, "OpenDaylightController");
entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER, "OpenDaylightController");
}
public static String getEntityForEvent(String eventName) {

View File

@ -128,6 +128,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
// add new Ovs provider
public static final Provider Ovs = new Provider("Ovs", false);
public static final Provider Opendaylight = new Provider("Opendaylight", false);
private final String name;
private final boolean isExternal;

View File

@ -94,7 +94,7 @@ public class Networks {
return uri.getSchemeSpecificPart();
}
},
Mido("mido", String.class), Pvlan("pvlan", String.class), Vxlan("vxlan", Long.class), UnDecided(null, null);
Mido("mido", String.class), Pvlan("pvlan", String.class), Vxlan("vxlan", Long.class), UnDecided(null, null), OpenDaylight("opendaylight", String.class);
private final String scheme;
private final Class<?> type;

View File

@ -33,7 +33,7 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
}
public enum IsolationMethod {
VLAN, L3, GRE, STT, VNS, MIDO, SSP, VXLAN;
VLAN, L3, GRE, STT, VNS, MIDO, SSP, VXLAN, ODL;
}
public enum BroadcastDomainRange {

View File

@ -57,6 +57,7 @@ public class NicProfile implements InternalIdentity {
String name;
String requestedIpv4;
String requestedIpv6;
String uuid;
public String getDns1() {
return dns1;
@ -142,6 +143,10 @@ public class NicProfile implements InternalIdentity {
this.format = format;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public void setTrafficType(TrafficType trafficType) {
this.trafficType = trafficType;
}
@ -215,29 +220,34 @@ public class NicProfile implements InternalIdentity {
return strategy;
}
public String getUuid() {
return uuid;
}
public NicProfile(Nic nic, Network network, URI broadcastUri, URI isolationUri, Integer networkRate, boolean isSecurityGroupEnabled, String name) {
this.id = nic.getId();
this.networkId = network.getId();
this.gateway = nic.getGateway();
this.mode = network.getMode();
this.broadcastType = network.getBroadcastDomainType();
this.trafficType = network.getTrafficType();
this.ip4Address = nic.getIp4Address();
this.format = nic.getAddressFormat();
this.ip6Address = nic.getIp6Address();
this.macAddress = nic.getMacAddress();
this.reservationId = nic.getReservationId();
this.strategy = nic.getReservationStrategy();
this.deviceId = nic.getDeviceId();
this.defaultNic = nic.isDefaultNic();
id = nic.getId();
networkId = network.getId();
gateway = nic.getGateway();
mode = network.getMode();
broadcastType = network.getBroadcastDomainType();
trafficType = network.getTrafficType();
ip4Address = nic.getIp4Address();
format = nic.getAddressFormat();
ip6Address = nic.getIp6Address();
macAddress = nic.getMacAddress();
reservationId = nic.getReservationId();
strategy = nic.getReservationStrategy();
deviceId = nic.getDeviceId();
defaultNic = nic.isDefaultNic();
this.broadcastUri = broadcastUri;
this.isolationUri = isolationUri;
this.netmask = nic.getNetmask();
netmask = nic.getNetmask();
this.isSecurityGroupEnabled = isSecurityGroupEnabled;
this.vmId = nic.getInstanceId();
vmId = nic.getInstanceId();
this.name = name;
this.ip6Cidr = nic.getIp6Cidr();
this.ip6Gateway = nic.getIp6Gateway();
ip6Cidr = nic.getIp6Cidr();
ip6Gateway = nic.getIp6Gateway();
uuid = nic.getUuid();
if (networkRate != null) {
this.networkRate = networkRate;
@ -245,7 +255,7 @@ public class NicProfile implements InternalIdentity {
}
public NicProfile(ReservationStrategy strategy, String ip4Address, String macAddress, String gateway, String netmask) {
this.format = AddressFormat.Ip4;
format = AddressFormat.Ip4;
this.ip4Address = ip4Address;
this.macAddress = macAddress;
this.gateway = gateway;
@ -274,11 +284,11 @@ public class NicProfile implements InternalIdentity {
}
public boolean isSecurityGroupEnabled() {
return this.isSecurityGroupEnabled;
return isSecurityGroupEnabled;
}
public void setSecurityGroupEnabled(boolean enabled) {
this.isSecurityGroupEnabled = enabled;
isSecurityGroupEnabled = enabled;
}
public String getRequestedIpv4() {
@ -286,22 +296,22 @@ public class NicProfile implements InternalIdentity {
}
public void deallocate() {
this.gateway = null;
this.mode = null;
this.format = null;
this.broadcastType = null;
this.trafficType = null;
this.ip4Address = null;
this.ip6Address = null;
this.macAddress = null;
this.reservationId = null;
this.strategy = null;
this.deviceId = null;
this.broadcastUri = null;
this.isolationUri = null;
this.netmask = null;
this.dns1 = null;
this.dns2 = null;
gateway = null;
mode = null;
format = null;
broadcastType = null;
trafficType = null;
ip4Address = null;
ip6Address = null;
macAddress = null;
reservationId = null;
strategy = null;
deviceId = null;
broadcastUri = null;
isolationUri = null;
netmask = null;
dns1 = null;
dns2 = null;
}
@Override

View File

@ -45,6 +45,7 @@ public interface ExternalNetworkDeviceManager extends Manager {
public static final NetworkDevice PaloAltoFirewall = new NetworkDevice("PaloAltoFirewall", Network.Provider.PaloAlto.getName());
public static final NetworkDevice NiciraNvp = new NetworkDevice("NiciraNvp", Network.Provider.NiciraNvp.getName());
public static final NetworkDevice CiscoVnmc = new NetworkDevice("CiscoVnmc", Network.Provider.CiscoVnmc.getName());
public static final NetworkDevice OpenDaylightController = new NetworkDevice("OpenDaylightController", Network.Provider.Opendaylight.getName());
public NetworkDevice(String deviceName, String ntwkServiceprovider) {
_name = deviceName;

View File

@ -130,6 +130,11 @@
<artifactId>cloud-plugin-network-vxlan</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-network-opendaylight</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-xen</artifactId>

View File

@ -706,3 +706,6 @@ importLdapUsers=3
#### juniper-contrail commands
createServiceInstance=1
### OpenDaylight plugin commands
addOpenDaylightController=1

View File

@ -225,3 +225,15 @@ CREATE TABLE `cloud`.`user_details` (
PRIMARY KEY (`id`),
CONSTRAINT `fk_user_details__user_id` FOREIGN KEY `fk_user_details__user_id`(`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`external_opendaylight_controllers` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`uuid` varchar(255) UNIQUE,
`physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which the device is added',
`provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this device',
`device_name` varchar(255) NOT NULL COMMENT 'name of the device',
`host_id` bigint unsigned NOT NULL COMMENT 'host id corresponding to the external device',
PRIMARY KEY (`id`),
CONSTRAINT `fk_external_opendaylight_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE,
CONSTRAINT `fk_external_opendaylight_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;