mirror of https://github.com/apache/cloudstack.git
WIP: configure ASA port profile
Signed-off-by: Chiradeep Vittal <chiradeep@apache.org>
This commit is contained in:
parent
1ae21ea49a
commit
6b142bbaab
|
|
@ -366,6 +366,108 @@ public class VsmCommand {
|
|||
}
|
||||
}
|
||||
|
||||
private static Element configPortProfileDetails(Document doc, String name, PortProfileType type,
|
||||
BindingType binding, SwitchPortMode mode, int vlanid, String VDC, String espName) {
|
||||
|
||||
// In mode, exec_configure.
|
||||
Element configure = doc.createElementNS(s_ciscons, "nxos:configure");
|
||||
Element modeConfigure = doc.createElement("nxos:" + s_configuremode);
|
||||
configure.appendChild(modeConfigure);
|
||||
|
||||
// Port profile name and type configuration.
|
||||
Element portProfile = doc.createElement("port-profile");
|
||||
modeConfigure.appendChild(portProfile);
|
||||
|
||||
// Port profile type.
|
||||
Element portDetails = doc.createElement("name");
|
||||
switch (type) {
|
||||
case none:
|
||||
portProfile.appendChild(portDetails);
|
||||
break;
|
||||
case ethernet:
|
||||
{
|
||||
Element typetag = doc.createElement("type");
|
||||
Element ethernettype = doc.createElement("ethernet");
|
||||
portProfile.appendChild(typetag);
|
||||
typetag.appendChild(ethernettype);
|
||||
ethernettype.appendChild(portDetails);
|
||||
}
|
||||
break;
|
||||
case vethernet:
|
||||
{
|
||||
Element typetag = doc.createElement("type");
|
||||
Element ethernettype = doc.createElement("vethernet");
|
||||
portProfile.appendChild(typetag);
|
||||
typetag.appendChild(ethernettype);
|
||||
ethernettype.appendChild(portDetails);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Port profile name.
|
||||
Element value = doc.createElement(s_paramvalue);
|
||||
value.setAttribute("isKey", "true");
|
||||
value.setTextContent(name);
|
||||
portDetails.appendChild(value);
|
||||
|
||||
// element for port prof mode.
|
||||
Element portProf = doc.createElement(s_portprofmode);
|
||||
portDetails.appendChild(portProf);
|
||||
|
||||
// Binding type.
|
||||
if (binding != BindingType.none) {
|
||||
portProf.appendChild(getBindingType(doc, binding));
|
||||
}
|
||||
|
||||
if (mode != SwitchPortMode.none) {
|
||||
// Switchport mode.
|
||||
portProf.appendChild(getSwitchPortMode(doc, mode));
|
||||
// Adding vlan details.
|
||||
if (vlanid > 0) {
|
||||
portProf.appendChild(getAddVlanDetails(doc, mode, Integer.toString(vlanid)));
|
||||
}
|
||||
}
|
||||
|
||||
// Command "vmware port-group".
|
||||
Element vmware = doc.createElement("vmware");
|
||||
Element portgroup = doc.createElement("port-group");
|
||||
vmware.appendChild(portgroup);
|
||||
portProf.appendChild(vmware);
|
||||
|
||||
//org root/TestTenant1/TestVDC
|
||||
//vservice node <Node Name> profile <Edge Security Profile Name in VNMC>
|
||||
Element org = doc.createElement("org");
|
||||
Element vdc = doc.createElement(VDC);
|
||||
org.appendChild(vdc);
|
||||
portProf.appendChild(org);
|
||||
|
||||
String asaNodeName = "ASA_" + vlanid;
|
||||
Element vservice = doc.createElement("vservice");
|
||||
vservice.appendChild(doc.createElement("node"))
|
||||
.appendChild(doc.createElement(asaNodeName))
|
||||
.appendChild(doc.createElement("profile"))
|
||||
.appendChild(doc.createElement(espName));
|
||||
|
||||
portProf.appendChild(vservice);
|
||||
|
||||
// no shutdown.
|
||||
Element no = doc.createElement("no");
|
||||
Element shutdown = doc.createElement("shutdown");
|
||||
no.appendChild(shutdown);
|
||||
portProf.appendChild(no);
|
||||
|
||||
// Enable the port profile.
|
||||
Element state = doc.createElement("state");
|
||||
Element enabled = doc.createElement("enabled");
|
||||
state.appendChild(enabled);
|
||||
portProf.appendChild(state);
|
||||
|
||||
// Persist the configuration across reboots.
|
||||
modeConfigure.appendChild(persistConfiguration(doc));
|
||||
|
||||
return configure;
|
||||
}
|
||||
|
||||
private static Element configPortProfileDetails(Document doc, String name, PortProfileType type,
|
||||
BindingType binding, SwitchPortMode mode, int vlanid) {
|
||||
|
||||
|
|
@ -433,6 +535,7 @@ public class VsmCommand {
|
|||
Element portgroup = doc.createElement("port-group");
|
||||
vmware.appendChild(portgroup);
|
||||
portProf.appendChild(vmware);
|
||||
|
||||
|
||||
// no shutdown.
|
||||
Element no = doc.createElement("no");
|
||||
|
|
|
|||
Loading…
Reference in New Issue