MCPcopy Create free account
hub / github.com/NetSys/bess / GetPortConf

Method GetPortConf

core/bessctl.cc:1065–1088  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1063 }
1064
1065 Status GetPortConf(ServerContext*, const GetPortConfRequest* request,
1066 GetPortConfResponse* response) override {
1067 std::lock_guard<std::recursive_mutex> lock(mutex_);
1068
1069 if (!request->name().length()) {
1070 return return_with_error(response, EINVAL, "Port name is not given");
1071 }
1072
1073 const char* port_name = request->name().c_str();
1074 const auto& it = PortBuilder::all_ports().find(port_name);
1075 if (it == PortBuilder::all_ports().end()) {
1076 return return_with_error(response, ENOENT, "No port `%s' found",
1077 port_name);
1078 }
1079
1080 Port::Conf conf = it->second->conf();
1081 bess::pb::PortConf* pb_conf = response->mutable_conf();
1082
1083 pb_conf->set_mac_addr(conf.mac_addr.ToString());
1084 pb_conf->set_mtu(conf.mtu);
1085 pb_conf->set_admin_up(conf.admin_up);
1086
1087 return Status::OK;
1088 }
1089
1090 Status DestroyPort(ServerContext*, const DestroyPortRequest* request,
1091 EmptyResponse* response) override {

Callers

nothing calls this directly

Calls 3

return_with_errorFunction · 0.85
ToStringMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected