1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

Feature #4215: Support IPv6 in VR management

This commit is contained in:
Carlos Martín 2015-12-18 17:10:48 +01:00
parent e3ffbd2409
commit 831372003d
2 changed files with 30 additions and 11 deletions

View File

@ -167,8 +167,6 @@ define(function(require) {
} }
} }
// TODO: VR edges with floating IPs
$.each(vrs, function(j,vr){ $.each(vrs, function(j,vr){
var nodeId = "vr"+vr; var nodeId = "vr"+vr;
@ -223,9 +221,14 @@ define(function(require) {
var label = undefined; var label = undefined;
// TODO: IPv6 IPs
if (lease.IP != undefined){ if (lease.IP != undefined){
label = lease.IP; label = lease.IP;
} else if (lease.IP6_GLOBAL != undefined){
label = lease.IP6_GLOBAL;
} else if (lease.IP6_ULA != undefined){
label = lease.IP6_ULA;
} else if (lease.IP6_LINK != undefined){
label = lease.IP6_LINK;
} }
edges.push({from: vnetNodeId, to: nodeId, label: label}); edges.push({from: vnetNodeId, to: nodeId, label: label});
@ -242,9 +245,14 @@ define(function(require) {
var label = undefined; var label = undefined;
// TODO: IPv6 IPs
if (lease.IP != undefined){ if (lease.IP != undefined){
label = lease.IP; label = lease.IP;
} else if (lease.IP6_GLOBAL != undefined){
label = lease.IP6_GLOBAL;
} else if (lease.IP6_ULA != undefined){
label = lease.IP6_ULA;
} else if (lease.IP6_LINK != undefined){
label = lease.IP6_LINK;
} }
edges.push({from: vnetNodeId, to: nodeId, label: label}); edges.push({from: vnetNodeId, to: nodeId, label: label});

View File

@ -401,13 +401,25 @@ int VirtualRouter::release_network_leases(VectorAttribute const * nic)
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
void vrouter_prefix(VectorAttribute* nic, const string& attr)
{
string val;
if (nic->vector_value(attr.c_str(), val) == 0)
{
nic->remove(attr);
nic->replace("VROUTER_"+attr, val);
}
}
/* -------------------------------------------------------------------------- */
Template * VirtualRouter::get_nics() const Template * VirtualRouter::get_nics() const
{ {
Template * tmpl = new Template(); Template * tmpl = new Template();
int num_nics; int num_nics;
bool floating; bool floating;
string ip;
vector<Attribute * > nics; vector<Attribute * > nics;
VectorAttribute * nic; VectorAttribute * nic;
@ -429,13 +441,12 @@ Template * VirtualRouter::get_nics() const
if (floating) if (floating)
{ {
// TODO: this is IPv4 only
nic->remove("MAC"); nic->remove("MAC");
if (nic->vector_value("IP", ip) == 0)
{ vrouter_prefix(nic, "IP");
nic->remove("IP"); vrouter_prefix(nic, "IP6_LINK");
nic->replace("VROUTER_IP", ip); vrouter_prefix(nic, "IP6_ULA");
} vrouter_prefix(nic, "IP6_GLOBAL");
// TODO: remove all other attrs, such as AR, BRIDGE, etc? // TODO: remove all other attrs, such as AR, BRIDGE, etc?
} }