}
public Boolean equalNetworkPolicy(NetworkACLVO db, NetworkPolicy policy, StringBuffer syncLogMesg) {
syncLogMesg.append("Policy# DB: " + db.getName() +
"; VNC: " + policy.getName() + "; action: equal\n");
NetworkPolicyModel current = _manager.getDatabase().lookupNetworkPolicy(policy.getUuid());
NetworkPolicyModel policyModel = new NetworkPolicyModel(db.getUuid(), db.getName());
net.juniper.contrail.api.types.Project project = null;
try {
project = _manager.getDefaultVncProject();
} catch (IOException ex) {
s_logger.warn("read project", ex);
}
policyModel.setProject(project);
List<NetworkACLItemVO> rules = _networkACLItemDao.listByACL(db.getId());
try {
policyModel.build(_manager.getModelController(), rules);
} catch (Exception e) {
e.printStackTrace();
}
if (_rw_mode) {
if (current != null) {
_manager.getDatabase().getNetworkPolicys().remove(current);
}
s_logger.debug("add policy model " + policyModel.getName());
_manager.getDatabase().getNetworkPolicys().add(policyModel);
try {
if (!policyModel.verify(_manager.getModelController())) {
policyModel.update(_manager.getModelController());
}
} catch (Exception ex) {
s_logger.warn("update network-policy", ex);
}
} else {