using namespace std;
const string TEST_MODULE = "keatest-module";
+const string IETF_TYPES = "ietf-inet-types";
+const string YANG_TYPES = "ietf-yang-types";
const string IETF_MODULE = "ietf-dhcpv6-server";
const string KEA_DHCP4_MODULE = "kea-dhcp4-server";
const string KEA_DHCP6_MODULE = "kea-dhcp6-server";
const string KEA_CTRL_AGENT_MODULE = "kea-ctrl-agent";
const string KEA_D2_MODULE = "kea-dhcp-ddns";
+// const string REPOSITORY = SYSREPO_REPO;
+const string REPOSITORY = "<sysrepo repository>";
/// @brief Returns nicely formed error message if module is missing
///
stringstream tmp;
tmp << "ERROR: YANG model " << name << " is not installed." << endl
<< "The environment is not suitable for running unit-tests." << endl
- << "Please locate " << name << ".yang and issue the following command:" << endl
- << endl
- << "# sysrepoctl -i -g " << name << ".yang" << endl
- << endl
- << "If sysrepoctl complains about missing data model, you may need to specify " << endl
- << "the default Sysrepo schema directory with -s PATH. You can check it with:" << endl
- << endl
- << "$ sysrepoctl -l" << endl
- << endl;
+ << "Please locate " << name << ".yang, change to its directory and "
+ << "issue the following command:" << endl << endl
+ << "# sysrepoctl -i -s " << REPOSITORY << "/yang "
+ << "-s . -g " << name << ".yang" << endl
+ << endl << endl;
return (tmp.str());
}
/// - daemon required
/// - session establishment
/// - test module
+/// - type modules
/// - IETF module
/// - Kea modules.
int main() {
try {
sess.reset(new Session(conn, SR_DS_CANDIDATE));
} catch (const sysrepo_exception& ex) {
- cerr << "ERROR: Can't establish a sysrepo session: " << ex.what() << endl;
+ cerr << "ERROR: Can't establish a sysrepo session: "
+ << ex.what() << endl;
exit(-3);
}
S_Yang_Schemas schemas;
exit(-4);
}
bool found_test = false;
+ bool found_ietf_types = false;
+ bool found_yang_types =false;
bool found_ietf = false;
bool found_kea4 = false;
bool found_kea6 = false;
}
if (module == TEST_MODULE) {
found_test = true;
+ } else if (module == IETF_TYPES) {
+ found_ietf_types = true;
+ } else if (module == YANG_TYPES) {
+ found_yang_types = true;
} else if (module == IETF_MODULE) {
found_ietf = true;
} else if (module == KEA_DHCP4_MODULE) {
int exit_code = 0;
+ if (!found_test || !found_ietf_types || !found_yang_types ||
+ !found_ietf || !found_kea4 || !found_kea6 || !found_keaca ||
+ !found_kea2) {
+ exit_code = 4;
+ }
+
if (!found_test) {
cerr << missingModuleText(TEST_MODULE);
- exit_code = -5;
+ --exit_code;
+ }
+
+ if (!found_ietf_types) {
+ cerr << missingModuleText(IETF_TYPES);
+ --exit_code;
+ }
+
+ if (!found_yang_types) {
+ cerr << missingModuleText(YANG_TYPES);
+ --exit_code;
}
if (!found_ietf) {
cerr << missingModuleText(IETF_MODULE);
- exit_code = -6;
+ --exit_code;
}
if (!found_kea4) {
cerr << missingModuleText(KEA_DHCP4_MODULE);
- exit_code = -7;
+ --exit_code;
}
if (!found_kea6) {
cerr << missingModuleText(KEA_DHCP6_MODULE);
- exit_code = -8;
+ --exit_code;
}
if (!found_keaca) {
cerr << missingModuleText(KEA_CTRL_AGENT_MODULE);
- exit_code = -9;
+ --exit_code;
}
if (!found_kea2) {
cerr << missingModuleText(KEA_D2_MODULE);
- exit_code = -10;
+ --exit_code;
}
exit(exit_code);