x.get("00:00:00:00:00:00:00:03").nextLevel.put("pktin",
dc.new CounterIndexStore(333, null));
// 1-level counter exists
String counterName = "00:00:00:00:00:00:00:01";
RetCtrInfo rci1 = dc.getCounterId("switch",counterName);
exp.levels = counterName.split("/");
exp.allLevelsFound = true;
exp.foundUptoLevel = 1;
exp.ctrIds[0] = 10;
exp.levels[0] = counterName;
assertEquals(exp, rci1);
// 1-level counter does not exist
counterName = "00:00:00:00:00:00:00:02";
RetCtrInfo rci2 = dc.getCounterId("switch", counterName);
exp.allLevelsFound = false;
exp.hierarchical = false;
exp.levels = counterName.split("/");
exp.foundUptoLevel = 0;
exp.ctrIds[0] = -1;
printRCI("got==> ", rci2);
printRCI("exp==> ", exp);
assertEquals(exp, rci2);
// 2-level hierarchical counter does not exist
counterName = "00:00:00:00:00:00:00:01/pktin";
RetCtrInfo rci3 = dc.getCounterId("switch", counterName);
exp.allLevelsFound = false;
exp.hierarchical = true;
exp.ctrIds[0] = 10;
exp.foundUptoLevel = 1;
exp.levels = counterName.split("/");
printRCI("got==> ", rci3);
printRCI("exp==> ", exp);
assertEquals(exp, rci3);
// 2-level hierarchical counter DOES exist
counterName = "00:00:00:00:00:00:00:03/pktin";
RetCtrInfo rci3x = dc.getCounterId("switch", counterName);
exp.allLevelsFound = true;
exp.hierarchical = true;
exp.foundUptoLevel = 2;
exp.ctrIds[0] = 30;
exp.ctrIds[1] = 333;
exp.levels = counterName.split("/");
printRCI("got==> ", rci3x);
printRCI("exp==> ", exp);
assertEquals(exp, rci3x);
// 2-level hierarchical counter does NOT exist
counterName = "00:00:00:00:00:00:00:03/pktout";
RetCtrInfo rci3y = dc.getCounterId("switch", counterName);
exp.allLevelsFound = false;
exp.hierarchical = true;
exp.foundUptoLevel = 1;
exp.ctrIds[0] = 30;
exp.ctrIds[1] = -1;
exp.levels = counterName.split("/");
printRCI("got==> ", rci3y);
printRCI("exp==> ", exp);
assertEquals(exp, rci3y);
// 3-level hierarchical counter does not exist
counterName = "00:00:00:00:00:00:00:03/pktin/drops";
RetCtrInfo rci4 = dc.getCounterId("switch", counterName);
exp.allLevelsFound = false;
exp.hierarchical = true;
exp.foundUptoLevel = 2;
exp.ctrIds[0] = 30;
exp.ctrIds[1] = 333;