### Question:
DebugCounter implements IFloodlightModule, IDebugCounterService { @Override public void resetCounterHierarchy(String moduleName, String counterHierarchy) { RetCtrInfo rci = getCounterId(moduleName, counterHierarchy); if (!rci.allLevelsFound) { String missing = rci.levels[rci.foundUptoLevel]; log.error("Cannot reset counter hierarchy - missing counter {}", missing); return; } allCounters[rci.ctrIds[rci.foundUptoLevel-1]].cvalue.set(0); ArrayList<Integer> resetIds = getHierarchyBelow(moduleName, rci); for (int index : resetIds) { allCounters[index].cvalue.set(0); } }  @Override IDebugCounter registerCounter(String moduleName, String counterHierarchy,
                           String counterDescription, CounterType counterType,
                           String... metaData); @Override void flushCounters(); @Override void resetCounterHierarchy(String moduleName, String counterHierarchy); @Override void resetAllCounters(); @Override void resetAllModuleCounters(String moduleName); @Override void enableCtrOnDemand(String moduleName, String counterHierarchy); @Override void disableCtrOnDemand(String moduleName, String counterHierarchy); @Override List<DebugCounterInfo> getCounterHierarchy(String moduleName,
                                                     String counterHierarchy); @Override List<DebugCounterInfo> getAllCounterValues(); @Override List<DebugCounterInfo> getModuleCounterValues(String moduleName); @Override boolean containsModuleCounterHierarchy(String moduleName,
                                                 String counterHierarchy); @Override boolean containsModuleName(String moduleName); @Override List<String> getModuleList(); @Override List<String> getModuleCounterList(String moduleName); @Override Collection<Class<? extends IFloodlightService>> getModuleServices(); @Override Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls(); @Override Collection<Class<? extends IFloodlightService>> getModuleDependencies(); @Override void init(FloodlightModuleContext context); @Override void startUp(FloodlightModuleContext context);  }### Answer:
@Test public void testBasicCounterReset() { testCounterHierarchy(); dc.resetCounterHierarchy("linkd", "tunnel"); checkCounters(1, 2, 0, 10, 20, 100, 105); dc.resetCounterHierarchy("switch", "S2"); checkCounters(1, 2, 0, 10, 20, 100, 105); dc.resetCounterHierarchy("swicth", "02"); checkCounters(1, 2, 0, 10, 20, 100, 105); dc.resetCounterHierarchy("switch", "02"); checkCounters(1, 0, 0, 10, 20, 100, 105); dc.resetCounterHierarchy("switch", "01/pktin/err"); checkCounters(1, 0, 0, 10, 20, 100, 0); dc.resetCounterHierarchy("switch", "01/pktin/drops"); checkCounters(1, 0, 0, 10, 20, 0, 0); }
@Test public void testHierarchicalCounterReset1() { testCounterHierarchy(); dc.resetCounterHierarchy("switch", "01/pktin"); checkCounters(1, 2, 3, 0, 20, 0, 0); }
@Test public void testHierarchicalCounterReset2() { testCounterHierarchy(); dc.resetCounterHierarchy("switch", "01"); checkCounters(0, 2, 3, 0, 0, 0, 0); }