#include <iostream>
#include <string>
class Device {
public:
std::string hostname;
std::string enableSecret;
std::string consolePassword;
std::string motdBanner;
void setHostname(const std::string& name) {
hostname = name;
std::cout << "Hostname set to " << hostname << std::endl;
}
void setEnableSecret(const std::string& secret) {
enableSecret = secret;
std::cout << "Enable secret set." << std::endl;
}
void setConsolePassword(const std::string& password) {
consolePassword = password;
std::cout << "Console password set." << std::endl;
}
void setMotdBanner(const std::string& banner) {
motdBanner = banner;
std::cout << "MOTD banner set: " << motdBanner << std::endl;
}
void showConfiguration() {
std::cout << "\nCurrent Configuration of " << hostname << ":\n";
std::cout << "Enable Secret: " << (enableSecret.empty() ? "Not Set" : "Set") << std::endl;
std::cout << "Console Password: " << (consolePassword.empty() ? "Not Set" : "Set") << std::endl;
std::cout << "MOTD Banner: " << (motdBanner.empty() ? "Not Set" : motdBanner) << std::endl;
}
};
class Switch : public Device {
public:
void configureSwitch() {
// Using sample values for the switch configuration
setHostname("Switch1");
setConsolePassword("cisco123");
setEnableSecret("enableSecret123");
setMotdBanner("# Welcome to Switch1 - Authorized Access Only! #");
}
};
class Router : public Device {
public:
void configureRouter() {
// Using sample values for the router configuration
setHostname("Router1");
setConsolePassword("routerpass");
setEnableSecret("routerEnableSecret");
setMotdBanner("# Welcome to Router1 - Authorized Access Only! #");
}
};
int main() {
Switch mySwitch;
Router myRouter;
std::cout << "Configuring Switch...\n";
mySwitch.configureSwitch();
mySwitch.showConfiguration();
std::cout << "\nConfiguring Router...\n";
myRouter.configureRouter();
myRouter.showConfiguration();
return 0;
}