Skip to content

Commit 9b45d7f

Browse files
committed
ofproto: Get rid of archaic "switch status" OpenFlow extension.
Back in 2008 or so, I introduced this extension as a way to provide information about switch status to the new "switch UI" program. Since then, the switch UI program has been removed and the important information that was provided by the switch status extension is now available in the database, so we might as well get rid of this extension, and that is what this commit does.
1 parent ee8b231 commit 9b45d7f

20 files changed

Lines changed: 25 additions & 544 deletions

include/openflow/nicira-ext.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,9 @@ OFP_ASSERT(sizeof(struct nicira_header) == 16);
126126

127127
/* Values for the 'subtype' member of struct nicira_header. */
128128
enum nicira_type {
129-
/* Switch status request. The request body is an ASCII string that
130-
* specifies a prefix of the key names to include in the output; if it is
131-
* the null string, then all key-value pairs are included. */
132-
NXT_STATUS_REQUEST,
133-
134-
/* Switch status reply. The reply body is an ASCII string of key-value
135-
* pairs in the form "key=value\n". */
136-
NXT_STATUS_REPLY,
137-
138129
/* No longer used. */
130+
NXT_STATUS_REQUEST__OBSOLETE,
131+
NXT_STATUS_REPLY__OBSOLETE,
139132
NXT_ACT_SET_CONFIG__OBSOLETE,
140133
NXT_ACT_GET_CONFIG__OBSOLETE,
141134
NXT_COMMAND_REQUEST__OBSOLETE,

lib/learning-switch.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2009, 2010 Nicira Networks.
2+
* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -238,8 +238,6 @@ lswitch_process_packet(struct lswitch *sw, struct rconn *rconn,
238238
case OFPUTIL_OFPST_PORT_REPLY:
239239
case OFPUTIL_OFPST_TABLE_REPLY:
240240
case OFPUTIL_OFPST_AGGREGATE_REPLY:
241-
case OFPUTIL_NXT_STATUS_REQUEST:
242-
case OFPUTIL_NXT_STATUS_REPLY:
243241
case OFPUTIL_NXT_TUN_ID_FROM_COOKIE:
244242
case OFPUTIL_NXT_ROLE_REQUEST:
245243
case OFPUTIL_NXT_ROLE_REPLY:

lib/ofp-print.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,18 +1320,6 @@ ofp_print_echo(struct ds *string, const struct ofp_header *oh, int verbosity)
13201320
}
13211321
}
13221322

1323-
static void
1324-
ofp_print_nxt_status_message(struct ds *string, const struct ofp_header *oh)
1325-
{
1326-
struct ofpbuf b;
1327-
1328-
ofpbuf_use_const(&b, oh, ntohs(oh->length));
1329-
ofpbuf_pull(&b, sizeof(struct nicira_header));
1330-
ds_put_cstr(string, " \"");
1331-
ds_put_printable(string, b.data, b.size);
1332-
ds_put_char(string, '"');
1333-
}
1334-
13351323
static void
13361324
ofp_print_nxt_tun_id_from_cookie(struct ds *string,
13371325
const struct nxt_tun_id_cookie *ntic)
@@ -1508,11 +1496,6 @@ ofp_to_string__(const struct ofp_header *oh,
15081496
ofp_print_ofpst_aggregate_reply(string, oh);
15091497
break;
15101498

1511-
case OFPUTIL_NXT_STATUS_REQUEST:
1512-
case OFPUTIL_NXT_STATUS_REPLY:
1513-
ofp_print_nxt_status_message(string, oh);
1514-
break;
1515-
15161499
case OFPUTIL_NXT_TUN_ID_FROM_COOKIE:
15171500
ofp_print_nxt_tun_id_from_cookie(string, msg);
15181501
break;

lib/ofp-util.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,6 @@ ofputil_decode_vendor(const struct ofp_header *oh,
399399
const struct ofputil_msg_type **typep)
400400
{
401401
static const struct ofputil_msg_type nxt_messages[] = {
402-
{ OFPUTIL_NXT_STATUS_REQUEST,
403-
NXT_STATUS_REQUEST, "NXT_STATUS_REQUEST",
404-
sizeof(struct nicira_header), 1 },
405-
406-
{ OFPUTIL_NXT_STATUS_REPLY,
407-
NXT_STATUS_REPLY, "NXT_STATUS_REPLY",
408-
sizeof(struct nicira_header), 1 },
409-
410402
{ OFPUTIL_NXT_TUN_ID_FROM_COOKIE,
411403
NXT_TUN_ID_FROM_COOKIE, "NXT_TUN_ID_FROM_COOKIE",
412404
sizeof(struct nxt_tun_id_cookie), 0 },

lib/ofp-util.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ enum ofputil_msg_code {
7171
OFPUTIL_OFPST_AGGREGATE_REPLY,
7272

7373
/* NXT_* messages. */
74-
OFPUTIL_NXT_STATUS_REQUEST,
75-
OFPUTIL_NXT_STATUS_REPLY,
7674
OFPUTIL_NXT_TUN_ID_FROM_COOKIE,
7775
OFPUTIL_NXT_ROLE_REQUEST,
7876
OFPUTIL_NXT_ROLE_REPLY,

ofproto/automake.mk

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2009, 2010 Nicira Networks, Inc.
1+
# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
22
#
33
# Copying and distribution of this file, with or without modification,
44
# are permitted in any medium without royalty provided the copyright
@@ -24,8 +24,6 @@ ofproto_libofproto_a_SOURCES = \
2424
ofproto/pktbuf.c \
2525
ofproto/pktbuf.h \
2626
ofproto/pinsched.c \
27-
ofproto/pinsched.h \
28-
ofproto/status.c \
29-
ofproto/status.h
27+
ofproto/pinsched.h
3028

3129
EXTRA_DIST += ofproto/ofproto-unixctl.man

ofproto/discovery.c

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2009, 2010 Nicira Networks.
2+
* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@
2929
#include "netdev.h"
3030
#include "openflow/openflow.h"
3131
#include "packets.h"
32-
#include "status.h"
3332
#include "stream-ssl.h"
3433
#include "vlog.h"
3534

@@ -42,63 +41,16 @@ struct discovery {
4241
regex_t *regex;
4342
struct dhclient *dhcp;
4443
int n_changes;
45-
struct status_category *ss_cat;
4644
};
4745

4846
static void modify_dhcp_request(struct dhcp_msg *, void *aux);
4947
static bool validate_dhcp_offer(const struct dhcp_msg *, void *aux);
5048

5149
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(60, 60);
5250

53-
static void
54-
discovery_status_cb(struct status_reply *sr, void *d_)
55-
{
56-
struct discovery *d = d_;
57-
58-
status_reply_put(sr, "accept-remote=%s", d->re);
59-
status_reply_put(sr, "n-changes=%d", d->n_changes);
60-
if (d->dhcp) {
61-
status_reply_put(sr, "state=%s", dhclient_get_state(d->dhcp));
62-
status_reply_put(sr, "state-elapsed=%u",
63-
dhclient_get_state_elapsed(d->dhcp));
64-
if (dhclient_is_bound(d->dhcp)) {
65-
uint32_t ip = dhclient_get_ip(d->dhcp);
66-
uint32_t netmask = dhclient_get_netmask(d->dhcp);
67-
uint32_t router = dhclient_get_router(d->dhcp);
68-
69-
const struct dhcp_msg *cfg = dhclient_get_config(d->dhcp);
70-
uint32_t dns_server;
71-
char *domain_name;
72-
int i;
73-
74-
status_reply_put(sr, "ip="IP_FMT, IP_ARGS(&ip));
75-
status_reply_put(sr, "netmask="IP_FMT, IP_ARGS(&netmask));
76-
if (router) {
77-
status_reply_put(sr, "router="IP_FMT, IP_ARGS(&router));
78-
}
79-
80-
for (i = 0; dhcp_msg_get_ip(cfg, DHCP_CODE_DNS_SERVER, i,
81-
&dns_server);
82-
i++) {
83-
status_reply_put(sr, "dns%d="IP_FMT, i, IP_ARGS(&dns_server));
84-
}
85-
86-
domain_name = dhcp_msg_get_string(cfg, DHCP_CODE_DOMAIN_NAME);
87-
if (domain_name) {
88-
status_reply_put(sr, "domain=%s", domain_name);
89-
free(domain_name);
90-
}
91-
92-
status_reply_put(sr, "lease-remaining=%u",
93-
dhclient_get_lease_remaining(d->dhcp));
94-
}
95-
}
96-
}
97-
9851
int
9952
discovery_create(const char *re, bool update_resolv_conf,
100-
struct dpif *dpif, struct switch_status *ss,
101-
struct discovery **discoveryp)
53+
struct dpif *dpif, struct discovery **discoveryp)
10254
{
10355
struct discovery *d;
10456
char local_name[IF_NAMESIZE];
@@ -133,9 +85,6 @@ discovery_create(const char *re, bool update_resolv_conf,
13385
dhclient_set_max_timeout(d->dhcp, 3);
13486
dhclient_init(d->dhcp, 0);
13587

136-
d->ss_cat = switch_status_register(ss, "discovery",
137-
discovery_status_cb, d);
138-
13988
*discoveryp = d;
14089
return 0;
14190

@@ -157,7 +106,6 @@ discovery_destroy(struct discovery *d)
157106
regfree(d->regex);
158107
free(d->regex);
159108
dhclient_destroy(d->dhcp);
160-
switch_status_unregister(d->ss_cat);
161109
free(d->dpif_name);
162110
free(d);
163111
}

ofproto/discovery.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2009, 2010 Nicira Networks.
2+
* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,11 +22,9 @@
2222
struct dpif;
2323
struct discovery;
2424
struct settings;
25-
struct switch_status;
2625

2726
int discovery_create(const char *accept_controller_re, bool update_resolv_conf,
28-
struct dpif *, struct switch_status *,
29-
struct discovery **);
27+
struct dpif *, struct discovery **);
3028
void discovery_destroy(struct discovery *);
3129
bool discovery_get_update_resolv_conf(const struct discovery *);
3230
void discovery_set_update_resolv_conf(struct discovery *,

ofproto/fail-open.c

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2009, 2010 Nicira Networks.
2+
* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@
2828
#include "pktbuf.h"
2929
#include "poll-loop.h"
3030
#include "rconn.h"
31-
#include "status.h"
3231
#include "timeval.h"
3332
#include "vconn.h"
3433
#include "vlog.h"
@@ -73,7 +72,6 @@ struct fail_open {
7372
struct rconn **controllers;
7473
size_t n_controllers;
7574
int last_disconn_secs;
76-
struct status_category *ss_cat;
7775
long long int next_bogus_packet_in;
7876
struct rconn_packet_counter *bogus_packet_counter;
7977
};
@@ -298,35 +296,19 @@ fail_open_flushed(struct fail_open *fo)
298296
}
299297
}
300298

301-
static void
302-
fail_open_status_cb(struct status_reply *sr, void *fo_)
303-
{
304-
struct fail_open *fo = fo_;
305-
int cur_duration = failure_duration(fo);
306-
int trigger = trigger_duration(fo);
307-
308-
status_reply_put(sr, "trigger-duration=%d", trigger);
309-
status_reply_put(sr, "current-duration=%d", cur_duration);
310-
status_reply_put(sr, "triggered=%s",
311-
cur_duration >= trigger ? "true" : "false");
312-
}
313-
314-
/* Creates and returns a new struct fail_open for 'ofproto', registering switch
315-
* status with 'switch_status'.
299+
/* Creates and returns a new struct fail_open for 'ofproto'.
316300
*
317301
* The caller should register its set of controllers with
318302
* fail_open_set_controllers(). (There should be at least one controller,
319303
* otherwise there isn't any point in having the struct fail_open around.) */
320304
struct fail_open *
321-
fail_open_create(struct ofproto *ofproto, struct switch_status *switch_status)
305+
fail_open_create(struct ofproto *ofproto)
322306
{
323307
struct fail_open *fo = xmalloc(sizeof *fo);
324308
fo->ofproto = ofproto;
325309
fo->controllers = NULL;
326310
fo->n_controllers = 0;
327311
fo->last_disconn_secs = 0;
328-
fo->ss_cat = switch_status_register(switch_status, "fail-open",
329-
fail_open_status_cb, fo);
330312
fo->next_bogus_packet_in = LLONG_MAX;
331313
fo->bogus_packet_counter = rconn_packet_counter_create();
332314
return fo;
@@ -355,7 +337,6 @@ fail_open_destroy(struct fail_open *fo)
355337
fail_open_recover(fo);
356338
free(fo->controllers);
357339
/* We don't own the rconns behind fo->controllers. */
358-
switch_status_unregister(fo->ss_cat);
359340
rconn_packet_counter_destroy(fo->bogus_packet_counter);
360341
free(fo);
361342
}

ofproto/fail-open.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2009, 2010 Nicira Networks.
2+
* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,15 +24,14 @@
2424
struct fail_open;
2525
struct ofproto;
2626
struct rconn;
27-
struct switch_status;
2827

2928
/* Priority of the rule added by the fail-open subsystem when a switch enters
3029
* fail-open mode. This priority value uniquely identifies a fail-open flow
3130
* (OpenFlow priorities max out at 65535 and nothing else in Open vSwitch
3231
* creates flows with this priority). And "f0" is mnemonic for "fail open"! */
3332
#define FAIL_OPEN_PRIORITY 0xf0f0f0
3433

35-
struct fail_open *fail_open_create(struct ofproto *, struct switch_status *);
34+
struct fail_open *fail_open_create(struct ofproto *);
3635
void fail_open_set_controllers(struct fail_open *, struct rconn **, size_t n);
3736
void fail_open_destroy(struct fail_open *);
3837
void fail_open_wait(struct fail_open *);

0 commit comments

Comments
 (0)