Commit 60d055c3 authored by David Johnson's avatar David Johnson

Add the node id, domainid, and ownerid to NodeInfo.

Well, for now, the id is the port id... will need to split that out
separately later on.
parent 33a77571
Pipeline #1925 passed with stage
in 30 seconds
......@@ -181,10 +181,14 @@ class NodeInfo(object):
self.name = result.name
self.ipv4 = IPv4Address(result.ipv4)
self.mac = MACAddress(result.mac)
self.id = result.id
self.domain = result.domain
self.owner = result.owner
def __str__(self):
return "NodeInfo(name={0}, ipv4={1}, mac={2})"\
.format(repr(self.name), self.ipv4, self.mac)
return "NodeInfo(name={0}, ipv4={1}, mac={2}, id={3}, domain={4}, owner={5})"\
.format(repr(self.name), self.ipv4, self.mac, self.id,
self.domain, self.owner)
def __repr__(self): return str(self)
......
......@@ -148,7 +148,8 @@ int cn_dispatch_result_push_item(cn_dispatch_result_t *result,
int cn_dispatch_result_item_init_info(cn_dispatch_result_item_t *item,
char * name,
const uint8_t ipv4[4],
const uint8_t mac[6]) {
const uint8_t mac[6],
char * id, char * domainid, char *ownerid) {
item->type = CN_RESULT_ITEM_INFO;
item->info.name = name != NULL ? strdup(name) : NULL;
if (name != NULL && item->info.name == NULL) {
......@@ -160,6 +161,9 @@ int cn_dispatch_result_item_init_info(cn_dispatch_result_item_t *item,
ipv4_nbo = htonl(ipv4_nbo);
memcpy(item->info.ipv4, &ipv4_nbo, sizeof(ipv4_nbo));
memcpy(item->info.mac, mac, sizeof(item->info.mac));
item->info.id = id != NULL ? strdup(id) : NULL;
item->info.domain = domainid != NULL ? strdup(domainid) : NULL;
item->info.owner = ownerid != NULL ? strdup(ownerid) : NULL;
return 0;
}
......@@ -191,6 +195,12 @@ void cn_dispatch_result_item_clear(cn_dispatch_result_item_t *item) {
item->info.name = NULL;
memset(item->info.ipv4, 0x0, 4);
memset(item->info.mac, 0x0, 6);
if (item->info.id) { free(item->info.id); }
item->info.id = NULL;
if (item->info.domain) { free(item->info.domain); }
item->info.domain = NULL;
if (item->info.owner) { free(item->info.owner); }
item->info.owner = NULL;
}
break;
case CN_RESULT_ITEM_CPTR: break;
......@@ -281,6 +291,9 @@ static int __cn_dispatch_result_fill_item(cn_dispatch_result_item_t *item,
reply_info->mac.data = item->info.mac;
reply_info->ipv4.len = sizeof(item->info.ipv4);
reply_info->ipv4.data = item->info.ipv4;
reply_info->id = item->info.id;
reply_info->domain = item->info.domain;
reply_info->owner = item->info.owner;
reply_item->result_node_info = reply_info;
}
break;
......@@ -1244,7 +1257,8 @@ int cn_dispatch_invoke(cn_principal_t *as, cn_dispatch_result_t *result,
check_dispatch_result_item(item);
cn_dispatch_result_item_init_info(item, node->name,
(uint8_t *) &node->ipv4.addr.s_addr,
node->mac);
node->mac,node->id,node->domainid,
node->ownerid);
cn_dispatch_result_push_item(result, item);
}
break;
......
......@@ -83,6 +83,9 @@ typedef struct {
char * name;
uint8_t ipv4[4];
uint8_t mac[6];
char * id;
char * domain;
char * owner;
} cn_dispatch_result_item_info_t;
typedef struct {
......@@ -137,7 +140,8 @@ cn_dispatch_result_item_t * cn_dispatch_result_item_alloc(void);
int cn_dispatch_result_item_init_info(cn_dispatch_result_item_t *item,
char * name,
const uint8_t ipv4[4],
const uint8_t mac[6]);
const uint8_t mac[6],
char * id, char * domainid, char *ownerid);
void cn_dispatch_result_item_init_cptr(cn_dispatch_result_item_t *item,
cptr_t cptr,
......
......@@ -77,6 +77,9 @@ message CPReplyItemNodeInfo {
required bytes ipv4 = 2;
// Always 6 bytes
required bytes mac = 3;
required string id = 4;
required string domain = 5;
required string owner = 6;
}
message CPReplyItemMessage {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment