2 * Copyright (c) 2015 CableLabs and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.packetcable.provider.validation.impl.validators.qos;
11 import org.opendaylight.controller.packetcable.provider.validation.ValidationException;
12 import org.opendaylight.controller.packetcable.provider.validation.impl.validators.AbstractValidator;
13 import org.opendaylight.yang.gen.v1.urn.packetcable.rev151026.pcmm.qos.gates.apps.App;
18 public class AppValidator extends AbstractValidator<App> {
20 private static final String APP_ID = "app.appId";
21 private static final String SUBSCRIBERS = "app.subscribers";
23 private final SubscribersValidator subscribersValidator = new SubscribersValidator();
26 public void validate(final App app, final Extent extent) throws ValidationException {
28 throw new ValidationException("app must exist");
31 mustExist(app.getAppId(), APP_ID);
32 mustExist(app.getSubscribers(), SUBSCRIBERS);
34 if (extent == Extent.NODE_AND_SUBTREE) {
35 validateChild(subscribersValidator, app.getSubscribers());
38 throwErrorsIfNeeded();