| 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 { |
nothing calls this directly
no test coverage detected