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 //Alert generation
public static final String ALERT_GENERATE = "ALERT.GENERATE"; 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 { static {
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking // 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_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName()); entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName());
entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, 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) { 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); public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
// add new Ovs provider // add new Ovs provider
public static final Provider Ovs = new Provider("Ovs", false); public static final Provider Ovs = new Provider("Ovs", false);
public static final Provider Opendaylight = new Provider("Opendaylight", false);
private final String name; private final String name;
private final boolean isExternal; private final boolean isExternal;

View File

@ -94,7 +94,7 @@ public class Networks {
return uri.getSchemeSpecificPart(); 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 String scheme;
private final Class<?> type; private final Class<?> type;

View File

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

View File

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

View File

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

View File

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

View File

@ -225,3 +225,15 @@ CREATE TABLE `cloud`.`user_details` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
CONSTRAINT `fk_user_details__user_id` FOREIGN KEY `fk_user_details__user_id`(`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE 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; ) 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;