# Viewing devices on Index Page in same column with different root models

**URL:** <https://forum.genieacs.com/t/viewing-devices-on-index-page-in-same-column-with-different-root-models/2762>\
**Category:** Uncategorized\
**Created:** [July 6, 2022, 5:59am UTC](https://forum.genieacs.com/t/viewing-devices-on-index-page-in-same-column-with-different-root-models/2762 "2022-07-06T05:59:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![clshinde](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@clshinde](https://forum.genieacs.com/u/clshinde)\
**Post date:** [July 6, 2022, 5:59am UTC](https://forum.genieacs.com/t/viewing-devices-on-index-page-in-same-column-with-different-root-models/2762/1 "2022-07-06T05:59:25Z")

</div>

I have multi vendor devices in my network, some devices use “InternetGatewayDevice” and some devices use “Device” root model. How to show parameters from both models in the same column on index page, current i use different columns like below in the index page:

- label: “‘IP’”  
parameter: InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress
- label: “‘IP-1’”  
parameter: Device.LAN.IPAddress

Thanks

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [July 6, 2022, 4:57pm UTC](https://forum.genieacs.com/t/viewing-devices-on-index-page-in-same-column-with-different-root-models/2762/2 "2022-07-06T16:57:34Z")

</div>

[VirtualParameters](https://docs.genieacs.com/en/latest/virtual-parameters.html) are the way to handle this.

---

<div class="post-metadata">

**Author:** ![clshinde](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@clshinde](https://forum.genieacs.com/u/clshinde)\
**Post date:** [July 14, 2022, 9:46am UTC](https://forum.genieacs.com/t/viewing-devices-on-index-page-in-same-column-with-different-root-models/2762/3 "2022-07-14T09:46:32Z")

</div>

Please can you elaborate, kinda a confused, an example would be much helpful

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [July 14, 2022, 6:36pm UTC](https://forum.genieacs.com/t/viewing-devices-on-index-page-in-same-column-with-different-root-models/2762/4 "2022-07-14T18:36:04Z")

</div>

There are lots of examples on the forum. The search function is your friend.

---

<div class="post-metadata">

**Author:** ![mtarifa](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/mtarifa/32/848_2.png) [@mtarifa](https://forum.genieacs.com/u/mtarifa)\
**Post date:** [July 16, 2022, 2:07am UTC](https://forum.genieacs.com/t/viewing-devices-on-index-page-in-same-column-with-different-root-models/2762/5 "2022-07-16T02:07:11Z")

</div>

Hi, here is some virtual parameter (sort rudimentary… sorry) that i build for my tests, using some code from the forum and modify just to bearly make it works 😉 .  
You need create a preset (trigger) and a provision (task) for that.

For this i remember that it is was not well documented, so you need to spend a lot of time find the correct post to get all togheter…doc + questions from differents posts, filling all holes…

-First you create a provision (named Refresh\_VParams) with:

```auto
// Script to refresh all virtualparameters (GENIE only)
// Mtarifa 2019
// Values possibles for return on virtualparameters
// xsd:base64
// xsd:boolean
// xsd:dateTime
// xsd:hexBinary
// xsd:int
// xsd:string
// xsd:unsignedInt

const now = Date.now();
const hourly = Date.now(3600000);
const daily = Date.now(86400000);
const ten_minutes = Date.now(600000);
const five_minutes = Date.now(300000);
const two_minutes = Date.now(120000);

log('[Refresh_VParams] Updating Virtual parameters every 5 minutes only...');
declare("VirtualParameters.*", {value: five_minutes});

```

-Then create a preset:

| Name | Channel | Weight | Schedule | Events | Precondition | Provision |
| --- | --- | --- | --- | --- | --- | --- |
| Refresh\_VParams | Refresh\_VParams | 0 | | -6 CONNECTION REQUEST, -7 TRANSFER COMPLETE, -8 DIAGNOSTICS COMPLETE | | Refresh\_VParams |

- Then you create some virtual parameter , example here is one i named IANA

```auto
// Example: Fetch IP for Internet DATA IPv6 IA-NA interface
// This script will find the interface Alias and look for the right value
// mtarifa 2020
let now = Date.now();
let m = 'None';
let x = 'temp';
let x2 = 'temp';
let ipaddress = '';
let foundintnames = false;
let founddnames = false;

const IntName_Huawei_1= "HSI"
const IntName_Huawei_2= "TR069_INTERNET"
const IntName_Huawei_3= "3_INTERNET_R_VID_450"
const IntName_Huawei_4= "3_INTERNET_R_VID_300"
const IntName_Huawei_5= "2_INTERNET_R_VID_450"
const DevName_Sagemcom= "IP_DATA"

let Manufacturer = declare("DeviceID.Manufacturer", {value: 1}).value[0];
let model = declare("DeviceID.ProductClass", {value: 1}).value[0];

switch(Manufacturer){
  case "Sagemcom":
    let dnames = declare("Device.IP.Interface.*.Alias",{path: now, value: now});
    for (let myint of dnames) {
      if (myint.value[0]== DevName_Sagemcom) {
        x = myint.path.substr(0, myint.path.lastIndexOf("."));
        log('[IANA] Found string of L3 root interface! Value of interface is ' + x);
        if ( declare(x + ".IPv6AddressNumberOfEntries", {path: now, value: now}).value[0] >= "2"){         
          let dnames2 = declare(x + ".IPv6Address.*.Alias",{path: 1, value: 1});
          for (let myint2 of dnames2) {
            if (myint2.value[0].match(/DHCPV6/)) {
              founddnames = true;
              x2 = myint2.path.substr(0, myint2.path.lastIndexOf("."));
              log('[IANA] Found string of interface L3 IPv6! Value of interface is ' + x2);
              ipaddress = declare(x2 + ".IPAddress", {path: now, value: now});
              break;
            }
          }       
        }
      if (founddnames) {
        log('[IANA] Value ' + ipaddress.value[0] + '') ;
        m = ipaddress.value[0];
      }
      else{
        log('[IANA] IPv6 IANA address not found!');
      }
      break;  
      }
    }
    break;
  
  case "Huawei Technologies Co., Ltd":
    let intnames = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANIPConnection.1.Name",{value: now});
    for (let myint of intnames) {
      if ( (myint.value[0]== IntName_Huawei_1) || (myint.value[0]== IntName_Huawei_2) || (myint.value[0]== IntName_Huawei_3) || (myint.value[0]== IntName_Huawei_4) || (myint.value[0]== IntName_Huawei_5) ) {
        x = myint.path.substr(0, myint.path.lastIndexOf("."));
        ipaddress = declare(x + ".X_HW_IPv6.IPv6Address.1.IPAddress", {value: now});
        
        if ( declare(x + ".X_HW_IPv6Enable", {path: now, value: now}).value[0] == true){
          foundintnames = true;
          ipaddress = declare(x + ".X_HW_IPv6.IPv6Address.1.IPAddress", {path: now, value: now});
          log('[IANA] Value ' + declare(x + ".X_HW_IPv6.IPv6Address.1.IPAddress", {path: now, value: now}).value[0] + '' ) ;
        }
       if (foundintnames) {
          m = ipaddress.value[0]; 
       }
        break;  
      }
    }
  break;
    
  default:
  break;
}

return {writable: false, value: [m, "xsd:string"]};

```

Now in each selected event (others than “-something” since “-” will tell to genie that not trigger under that event) it will execute all virtual parameters you have, since the provisioning will search for all virtualparameters.

Then and for visualize you can use the new TR069 virtual node as “VirtualParameters.IANA” per example. you can add in the index or device page

Hope this help.
